From a900d8df6d9cb483f872e8e1eace62922435adfe Mon Sep 17 00:00:00 2001 From: David Humphrey Date: Sun, 15 Jul 2018 13:25:35 -0400 Subject: [PATCH] Add eslint --fix scripts, fix first round of lint errors --- package.json | 3 + src/buffer.js | 2 +- src/constants.js | 4 +- src/filesystem/implementation.js | 12 +- src/filesystem/interface.js | 4 +- src/node.js | 16 +-- src/path.js | 10 +- src/providers/index.js | 2 +- src/providers/memory.js | 6 +- src/providers/websql.js | 28 ++-- src/shell/shell.js | 4 +- tests/bugs/issue357.js | 4 +- tests/index.js | 128 +++++++++--------- tests/lib/indexeddb.js | 2 +- tests/lib/test-utils.js | 32 ++--- tests/spec/errors.spec.js | 8 +- tests/spec/filer.filesystem.spec.js | 2 +- tests/spec/filer.spec.js | 8 +- tests/spec/fs.appendFile.spec.js | 26 ++-- tests/spec/fs.link.spec.js | 2 +- tests/spec/fs.lstat.spec.js | 2 +- tests/spec/fs.mkdir.spec.js | 4 +- tests/spec/fs.open.spec.js | 8 +- tests/spec/fs.readdir.spec.js | 2 +- tests/spec/fs.readlink.spec.js | 4 +- tests/spec/fs.rmdir.spec.js | 10 +- tests/spec/fs.shell.spec.js | 8 +- tests/spec/fs.spec.js | 4 +- tests/spec/fs.stat.spec.js | 2 +- tests/spec/fs.stats.spec.js | 6 +- tests/spec/fs.symlink.spec.js | 4 +- tests/spec/fs.truncate.spec.js | 6 +- tests/spec/fs.utimes.spec.js | 2 +- tests/spec/fs.writeFile-readFile.spec.js | 14 +- tests/spec/fs.xattr.spec.js | 2 +- tests/spec/node-js/simple/test-fs-mkdir.js | 2 +- .../spec/node-js/simple/test-fs-null-bytes.js | 8 +- .../node-js/simple/test-fs-watch-recursive.js | 2 +- tests/spec/node-js/simple/test-fs-watch.js | 4 +- tests/spec/path-resolution.spec.js | 4 +- tests/spec/providers/providers.base.js | 46 +++---- tests/spec/providers/providers.spec.js | 14 +- tests/spec/shell/cat.spec.js | 10 +- tests/spec/shell/env.spec.js | 2 +- tests/spec/shell/exec.spec.js | 2 +- tests/spec/shell/ls.spec.js | 10 +- tests/spec/shell/rm.spec.js | 6 +- tests/spec/time-flags.spec.js | 4 +- tests/spec/times.spec.js | 6 +- 49 files changed, 252 insertions(+), 249 deletions(-) diff --git a/package.json b/package.json index f4509d0..793b9c7 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,10 @@ "bugs": "https://github.com/filerjs/filer/issues", "license": "BSD-2-Clause", "scripts": { + "eslint": "npm run lint", + "eslint:fix": "npm run lint:fix", "lint": "eslint src tests", + "lint:fix": "eslint --fix src tests", "test:manual": "parcel tests/index.html --out-dir tests/dist", "pretest": "npm run lint", "test": "npm run travis", diff --git a/src/buffer.js b/src/buffer.js index bf8745e..6286d33 100644 --- a/src/buffer.js +++ b/src/buffer.js @@ -7,7 +7,7 @@ function FilerBuffer (subject, encoding, nonZero) { } return new Buffer(subject, encoding, nonZero); -}; +} // Inherit prototype from Buffer FilerBuffer.prototype = Object.create(Buffer.prototype); diff --git a/src/constants.js b/src/constants.js index 2b9f980..b783d6f 100644 --- a/src/constants.js +++ b/src/constants.js @@ -15,9 +15,9 @@ module.exports = { IDB_RO: 'readonly', IDB_RW: 'readwrite', - WSQL_VERSION: "1", + WSQL_VERSION: '1', WSQL_SIZE: 5 * 1024 * 1024, - WSQL_DESC: "FileSystem Storage", + WSQL_DESC: 'FileSystem Storage', NODE_TYPE_FILE: 'FILE', NODE_TYPE_DIRECTORY: 'DIRECTORY', diff --git a/src/filesystem/implementation.js b/src/filesystem/implementation.js index b6d0910..377af8b 100644 --- a/src/filesystem/implementation.js +++ b/src/filesystem/implementation.js @@ -1572,9 +1572,9 @@ function validate_flags(flags) { function validate_file_options(options, enc, fileMode){ if(!options) { options = { encoding: enc, flag: fileMode }; - } else if(typeof options === "function") { + } else if(typeof options === 'function') { options = { encoding: enc, flag: fileMode }; - } else if(typeof options === "string") { + } else if(typeof options === 'string') { options = { encoding: options, flag: fileMode }; } return options; @@ -1832,10 +1832,10 @@ function writeFile(fs, context, path, data, options, callback) { } data = data || ''; - if(typeof data === "number") { + if(typeof data === 'number') { data = '' + data; } - if(typeof data === "string" && options.encoding === 'utf8') { + if(typeof data === 'string' && options.encoding === 'utf8') { data = Encoding.encode(data); } @@ -1869,10 +1869,10 @@ function appendFile(fs, context, path, data, options, callback) { } data = data || ''; - if(typeof data === "number") { + if(typeof data === 'number') { data = '' + data; } - if(typeof data === "string" && options.encoding === 'utf8') { + if(typeof data === 'string' && options.encoding === 'utf8') { data = Encoding.encode(data); } diff --git a/src/filesystem/interface.js b/src/filesystem/interface.js index 719fd35..e5ba6ea 100644 --- a/src/filesystem/interface.js +++ b/src/filesystem/interface.js @@ -29,7 +29,7 @@ var impl = require('./implementation.js'); // node.js supports a calling pattern that leaves off a callback. function maybeCallback(callback) { - if(typeof callback === "function") { + if(typeof callback === 'function') { return callback; } return function(err) { @@ -104,7 +104,7 @@ function FileSystem(options, callback) { // descriptor management functions var openFiles = {}; var nextDescriptor = FIRST_DESCRIPTOR; - Object.defineProperty(this, "openFiles", { + Object.defineProperty(this, 'openFiles', { get: function() { return openFiles; } }); this.allocDescriptor = function(openFileDescription) { diff --git a/src/node.js b/src/node.js index 9c15166..3ed381b 100644 --- a/src/node.js +++ b/src/node.js @@ -14,15 +14,15 @@ var DEFAULT_DIR_PERMISSIONS = require('./constants.js').DEFAULT_DIR_PERMISSIONS; function getMode(type, mode) { switch(type) { - case NODE_TYPE_DIRECTORY: - return (mode || DEFAULT_DIR_PERMISSIONS) | S_IFDIR; - case NODE_TYPE_SYMBOLIC_LINK: - return (mode || DEFAULT_FILE_PERMISSIONS) | S_IFLNK; + case NODE_TYPE_DIRECTORY: + return (mode || DEFAULT_DIR_PERMISSIONS) | S_IFDIR; + case NODE_TYPE_SYMBOLIC_LINK: + return (mode || DEFAULT_FILE_PERMISSIONS) | S_IFLNK; /* jshint -W086 */ - case NODE_TYPE_FILE: - // falls through - default: - return (mode || DEFAULT_FILE_PERMISSIONS) | S_IFREG; + case NODE_TYPE_FILE: + // falls through + default: + return (mode || DEFAULT_FILE_PERMISSIONS) | S_IFREG; } } diff --git a/src/path.js b/src/path.js index 87c57f7..d845b52 100644 --- a/src/path.js +++ b/src/path.js @@ -63,7 +63,7 @@ var splitPath = function(filename) { // path.resolve([from ...], to) function resolve() { var resolvedPath = '', - resolvedAbsolute = false; + resolvedAbsolute = false; for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { // XXXfiler: we don't have process.cwd() so we use '/' as a fallback @@ -92,7 +92,7 @@ function resolve() { // path.normalize(path) function normalize(path) { var isAbsolute = path.charAt(0) === '/', - trailingSlash = path.substr(-1) === '/'; + trailingSlash = path.substr(-1) === '/'; // Normalize the path path = normalizeArray(path.split('/').filter(function(p) { @@ -162,8 +162,8 @@ function relative(from, to) { function dirname(path) { var result = splitPath(path), - root = result[0], - dir = result[1]; + root = result[0], + dir = result[1]; if (!root && !dir) { // No dirname whatsoever @@ -185,7 +185,7 @@ function basename(path, ext) { f = f.substr(0, f.length - ext.length); } // XXXfiler: node.js just does `return f` - return f === "" ? "/" : f; + return f === '' ? '/' : f; } function extname(path) { diff --git a/src/providers/index.js b/src/providers/index.js index eb608b0..d52d5f0 100644 --- a/src/providers/index.js +++ b/src/providers/index.js @@ -25,7 +25,7 @@ module.exports = { } function NotSupported() { - throw "[Filer Error] Your browser doesn't support IndexedDB or WebSQL."; + throw '[Filer Error] Your browser doesn\'t support IndexedDB or WebSQL.'; } NotSupported.isSupported = function() { return false; diff --git a/src/providers/memory.js b/src/providers/memory.js index 2998cf9..048e7da 100644 --- a/src/providers/memory.js +++ b/src/providers/memory.js @@ -24,7 +24,7 @@ function MemoryContext(db, readOnly) { MemoryContext.prototype.clear = function(callback) { if(this.readOnly) { asyncCallback(function() { - callback("[MemoryContext] Error: write operation on read only context"); + callback('[MemoryContext] Error: write operation on read only context'); }); return; } @@ -49,7 +49,7 @@ MemoryContext.prototype.putBuffer = function(key, value, callback) { if(this.readOnly) { asyncCallback(function() { - callback("[MemoryContext] Error: write operation on read only context"); + callback('[MemoryContext] Error: write operation on read only context'); }); return; } @@ -60,7 +60,7 @@ function(key, value, callback) { MemoryContext.prototype.delete = function(key, callback) { if(this.readOnly) { asyncCallback(function() { - callback("[MemoryContext] Error: write operation on read only context"); + callback('[MemoryContext] Error: write operation on read only context'); }); return; } diff --git a/src/providers/websql.js b/src/providers/websql.js index eb35589..77d28f3 100644 --- a/src/providers/websql.js +++ b/src/providers/websql.js @@ -30,8 +30,8 @@ WebSQLContext.prototype.clear = function(callback) { callback(null); } this.getTransaction(function(transaction) { - transaction.executeSql("DELETE FROM " + FILE_STORE_NAME + ";", - [], onSuccess, onError); + transaction.executeSql('DELETE FROM ' + FILE_STORE_NAME + ';', + [], onSuccess, onError); }); }; @@ -45,8 +45,8 @@ function _get(getTransaction, key, callback) { callback(error); } getTransaction(function(transaction) { - transaction.executeSql("SELECT data FROM " + FILE_STORE_NAME + " WHERE id = ? LIMIT 1;", - [key], onSuccess, onError); + transaction.executeSql('SELECT data FROM ' + FILE_STORE_NAME + ' WHERE id = ? LIMIT 1;', + [key], onSuccess, onError); }); } WebSQLContext.prototype.getObject = function(key, callback) { @@ -90,8 +90,8 @@ function _put(getTransaction, key, value, callback) { callback(error); } getTransaction(function(transaction) { - transaction.executeSql("INSERT OR REPLACE INTO " + FILE_STORE_NAME + " (id, data) VALUES (?, ?);", - [key, value], onSuccess, onError); + transaction.executeSql('INSERT OR REPLACE INTO ' + FILE_STORE_NAME + ' (id, data) VALUES (?, ?);', + [key, value], onSuccess, onError); }); } WebSQLContext.prototype.putObject = function(key, value, callback) { @@ -111,8 +111,8 @@ WebSQLContext.prototype.delete = function(key, callback) { callback(error); } this.getTransaction(function(transaction) { - transaction.executeSql("DELETE FROM " + FILE_STORE_NAME + " WHERE id = ?;", - [key], onSuccess, onError); + transaction.executeSql('DELETE FROM ' + FILE_STORE_NAME + ' WHERE id = ?;', + [key], onSuccess, onError); }); }; @@ -135,7 +135,7 @@ WebSQL.prototype.open = function(callback) { var db = global.openDatabase(that.name, WSQL_VERSION, WSQL_DESC, WSQL_SIZE); if(!db) { - callback("[WebSQL] Unable to open database."); + callback('[WebSQL] Unable to open database.'); return; } @@ -153,12 +153,12 @@ WebSQL.prototype.open = function(callback) { // Create the table and index we'll need to store the fs data. db.transaction(function(transaction) { function createIndex(transaction) { - transaction.executeSql("CREATE INDEX IF NOT EXISTS idx_" + FILE_STORE_NAME + "_id" + - " on " + FILE_STORE_NAME + " (id);", - [], onSuccess, onError); + transaction.executeSql('CREATE INDEX IF NOT EXISTS idx_' + FILE_STORE_NAME + '_id' + + ' on ' + FILE_STORE_NAME + ' (id);', + [], onSuccess, onError); } - transaction.executeSql("CREATE TABLE IF NOT EXISTS " + FILE_STORE_NAME + " (id unique, data TEXT);", - [], createIndex, onError); + transaction.executeSql('CREATE TABLE IF NOT EXISTS ' + FILE_STORE_NAME + ' (id unique, data TEXT);', + [], createIndex, onError); }); }; WebSQL.prototype.getReadOnlyContext = function() { diff --git a/src/shell/shell.js b/src/shell/shell.js index 92e0c57..89a895c 100644 --- a/src/shell/shell.js +++ b/src/shell/shell.js @@ -87,7 +87,7 @@ Shell.prototype.exec = function(path, args, callback) { callback = callback || function(){}; path = Path.resolve(sh.pwd(), path); - fs.readFile(path, "utf8", function(error, data) { + fs.readFile(path, 'utf8', function(error, data) { if(error) { callback(error); return; @@ -432,7 +432,7 @@ Shell.prototype.mkdirp = function(path, callback) { * `find` returns a flat array of absolute paths for all matching/found * paths as the final argument to the callback. */ - Shell.prototype.find = function(path, options, callback) { +Shell.prototype.find = function(path, options, callback) { var sh = this; var fs = sh.fs; if(typeof options === 'function') { diff --git a/tests/bugs/issue357.js b/tests/bugs/issue357.js index eb8bb53..870de50 100644 --- a/tests/bugs/issue357.js +++ b/tests/bugs/issue357.js @@ -3,10 +3,10 @@ var expect = require('chai').expect; describe('Path.resolve does not work, issue357', function() { it('Path.relative() should not crash', function() { - expect(Path.relative("/mydir", "/mydir/file")).to.equal("file"); + expect(Path.relative('/mydir', '/mydir/file')).to.equal('file'); // https://nodejs.org/api/path.html#path_path_relative_from_to - expect(Path.relative("/data/orandea/test/aaa", "/data/orandea/impl/bbb")).to.equal("../../impl/bbb"); + expect(Path.relative('/data/orandea/test/aaa', '/data/orandea/impl/bbb')).to.equal('../../impl/bbb'); }); it('Path.resolve() should work as expectedh', function() { diff --git a/tests/index.js b/tests/index.js index 7b32430..e49c342 100644 --- a/tests/index.js +++ b/tests/index.js @@ -4,77 +4,77 @@ */ // Filer -require("./spec/filer.spec"); +require('./spec/filer.spec'); // Filer.FileSystem.* -require("./spec/filer.filesystem.spec"); -require("./spec/fs.spec"); -require("./spec/fs.stat.spec"); -require("./spec/fs.lstat.spec"); -require("./spec/fs.exists.spec"); -require("./spec/fs.mknod.spec"); -require("./spec/fs.mkdir.spec"); -require("./spec/fs.readdir.spec"); -require("./spec/fs.rmdir.spec"); -require("./spec/fs.open.spec"); -require("./spec/fs.write.spec"); -require("./spec/fs.writeFile-readFile.spec"); -require("./spec/fs.appendFile.spec"); -require("./spec/fs.read.spec"); -require("./spec/fs.close.spec"); -require("./spec/fs.link.spec"); -require("./spec/fs.unlink.spec"); -require("./spec/fs.rename.spec"); -require("./spec/fs.lseek.spec"); -require("./spec/fs.symlink.spec"); -require("./spec/fs.readlink.spec"); -require("./spec/fs.truncate.spec"); -require("./spec/fs.utimes.spec"); -require("./spec/fs.xattr.spec"); -require("./spec/fs.stats.spec"); -require("./spec/path-resolution.spec"); -require("./spec/trailing-slashes.spec"); -require("./spec/times.spec"); -require("./spec/time-flags.spec"); -require("./spec/fs.watch.spec"); -require("./spec/errors.spec"); -require("./spec/fs.shell.spec"); -require("./spec/fs.chmod.spec"); -require("./spec/fs.chown.spec") +require('./spec/filer.filesystem.spec'); +require('./spec/fs.spec'); +require('./spec/fs.stat.spec'); +require('./spec/fs.lstat.spec'); +require('./spec/fs.exists.spec'); +require('./spec/fs.mknod.spec'); +require('./spec/fs.mkdir.spec'); +require('./spec/fs.readdir.spec'); +require('./spec/fs.rmdir.spec'); +require('./spec/fs.open.spec'); +require('./spec/fs.write.spec'); +require('./spec/fs.writeFile-readFile.spec'); +require('./spec/fs.appendFile.spec'); +require('./spec/fs.read.spec'); +require('./spec/fs.close.spec'); +require('./spec/fs.link.spec'); +require('./spec/fs.unlink.spec'); +require('./spec/fs.rename.spec'); +require('./spec/fs.lseek.spec'); +require('./spec/fs.symlink.spec'); +require('./spec/fs.readlink.spec'); +require('./spec/fs.truncate.spec'); +require('./spec/fs.utimes.spec'); +require('./spec/fs.xattr.spec'); +require('./spec/fs.stats.spec'); +require('./spec/path-resolution.spec'); +require('./spec/trailing-slashes.spec'); +require('./spec/times.spec'); +require('./spec/time-flags.spec'); +require('./spec/fs.watch.spec'); +require('./spec/errors.spec'); +require('./spec/fs.shell.spec'); +require('./spec/fs.chmod.spec'); +require('./spec/fs.chown.spec'); // Filer.FileSystem.providers.* -require("./spec/providers/providers.spec"); -require("./spec/providers/providers.indexeddb.spec"); -require("./spec/providers/providers.websql.spec"); -require("./spec/providers/providers.memory.spec"); +require('./spec/providers/providers.spec'); +require('./spec/providers/providers.indexeddb.spec'); +require('./spec/providers/providers.websql.spec'); +require('./spec/providers/providers.memory.spec'); // Filer.FileSystemShell.* -require("./spec/shell/cd.spec"); -require("./spec/shell/touch.spec"); -require("./spec/shell/exec.spec"); -require("./spec/shell/cat.spec"); -require("./spec/shell/ls.spec"); -require("./spec/shell/rm.spec"); -require("./spec/shell/env.spec"); -require("./spec/shell/mkdirp.spec"); -require("./spec/shell/find.spec"); +require('./spec/shell/cd.spec'); +require('./spec/shell/touch.spec'); +require('./spec/shell/exec.spec'); +require('./spec/shell/cat.spec'); +require('./spec/shell/ls.spec'); +require('./spec/shell/rm.spec'); +require('./spec/shell/env.spec'); +require('./spec/shell/mkdirp.spec'); +require('./spec/shell/find.spec'); // Ported node.js tests (filenames match names in https://github.com/joyent/node/tree/master/test) -require("./spec/node-js/simple/test-fs-mkdir"); -require("./spec/node-js/simple/test-fs-null-bytes"); -require("./spec/node-js/simple/test-fs-watch"); -require("./spec/node-js/simple/test-fs-watch-recursive"); +require('./spec/node-js/simple/test-fs-mkdir'); +require('./spec/node-js/simple/test-fs-null-bytes'); +require('./spec/node-js/simple/test-fs-watch'); +require('./spec/node-js/simple/test-fs-watch-recursive'); // Regressions, Bugs -require("./bugs/issue105"); -require("./bugs/issue106"); -require("./bugs/issue239"); -require("./bugs/issue249"); -require("./bugs/ls-depth-bug"); -require("./bugs/issue247.js"); -require("./bugs/issue254.js"); -require("./bugs/issue258.js"); -require("./bugs/issue267.js"); -require("./bugs/issue270.js"); -require("./bugs/rename-dir-trailing-slash.js"); -require("./bugs/issue357.js"); +require('./bugs/issue105'); +require('./bugs/issue106'); +require('./bugs/issue239'); +require('./bugs/issue249'); +require('./bugs/ls-depth-bug'); +require('./bugs/issue247.js'); +require('./bugs/issue254.js'); +require('./bugs/issue258.js'); +require('./bugs/issue267.js'); +require('./bugs/issue270.js'); +require('./bugs/rename-dir-trailing-slash.js'); +require('./bugs/issue357.js'); diff --git a/tests/lib/indexeddb.js b/tests/lib/indexeddb.js index 4a2b3fe..4dbc505 100644 --- a/tests/lib/indexeddb.js +++ b/tests/lib/indexeddb.js @@ -40,7 +40,7 @@ function IndexedDBTestProvider(name) { request.onsuccess = finished; request.onerror = finished; } catch(e) { - console.log("Failed to delete test database", e); + console.log('Failed to delete test database', e); finished(); } } diff --git a/tests/lib/test-utils.js b/tests/lib/test-utils.js index ffe0035..80a12e4 100644 --- a/tests/lib/test-utils.js +++ b/tests/lib/test-utils.js @@ -58,20 +58,20 @@ function setup(callback) { var name = uniqueName(); switch(providerType.toLowerCase()) { - case 'indexeddb': - _provider = new IndexedDBTestProvider(name); - break; - case 'websql': - _provider = new WebSQLTestProvider(name); - break; - case 'memory': - _provider = new MemoryTestProvider(name); - break; - case 'default': - default: - var BestProvider = findBestProvider(); - _provider = new BestProvider(name); - break; + case 'indexeddb': + _provider = new IndexedDBTestProvider(name); + break; + case 'websql': + _provider = new WebSQLTestProvider(name); + break; + case 'memory': + _provider = new MemoryTestProvider(name); + break; + case 'default': + default: + var BestProvider = findBestProvider(); + _provider = new BestProvider(name); + break; } // Allow passing FS flags on query string @@ -95,14 +95,14 @@ function setup(callback) { function fs() { if(!_fs) { - throw "TestUtil: call setup() before fs()"; + throw 'TestUtil: call setup() before fs()'; } return _fs; } function provider() { if(!_provider) { - throw "TestUtil: call setup() before provider()"; + throw 'TestUtil: call setup() before provider()'; } return _provider; } diff --git a/tests/spec/errors.spec.js b/tests/spec/errors.spec.js index 8c6fcd6..1d6e5bb 100644 --- a/tests/spec/errors.spec.js +++ b/tests/spec/errors.spec.js @@ -1,8 +1,8 @@ var Filer = require('../../src'); var expect = require('chai').expect; -describe("Filer.Errors", function() { - it("has expected errors", function() { +describe('Filer.Errors', function() { + it('has expected errors', function() { expect(Filer.Errors).to.exist; // By ctor -- if you add some to src/errors.js, also add here @@ -165,12 +165,12 @@ describe("Filer.Errors", function() { it('should not include path in toString() when not provided', function() { var err = new Filer.Errors.ENOENT('This is the message'); - expect(err.toString()).to.equal("ENOENT: This is the message"); + expect(err.toString()).to.equal('ENOENT: This is the message'); }); it('should include path in toString() when provided', function() { var err = new Filer.Errors.ENOENT(null, '/this/is/the/path'); - expect(err.toString()).to.equal("ENOENT: no such file or directory, '/this/is/the/path'"); + expect(err.toString()).to.equal('ENOENT: no such file or directory, \'/this/is/the/path\''); }); it('should include message and path info when provided', function() { diff --git a/tests/spec/filer.filesystem.spec.js b/tests/spec/filer.filesystem.spec.js index 243e4dc..17fc8c1 100644 --- a/tests/spec/filer.filesystem.spec.js +++ b/tests/spec/filer.filesystem.spec.js @@ -2,7 +2,7 @@ var Filer = require('../../src'); var util = require('../lib/test-utils.js'); var expect = require('chai').expect; -describe("Filer.FileSystem", function() { +describe('Filer.FileSystem', function() { beforeEach(util.setup); afterEach(util.cleanup); diff --git a/tests/spec/filer.spec.js b/tests/spec/filer.spec.js index b6fb385..0d9b610 100644 --- a/tests/spec/filer.spec.js +++ b/tests/spec/filer.spec.js @@ -1,16 +1,16 @@ var Filer = require('../../src'); var expect = require('chai').expect; -describe("Filer", function() { - it("is defined", function() { +describe('Filer', function() { + it('is defined', function() { expect(typeof Filer).not.to.equal(undefined); }); - it("has FileSystem constructor", function() { + it('has FileSystem constructor', function() { expect(typeof Filer.FileSystem).to.equal('function'); }); - it("has Shell constructor", function() { + it('has Shell constructor', function() { expect(typeof Filer.Shell).to.equal('function'); }); }); diff --git a/tests/spec/fs.appendFile.spec.js b/tests/spec/fs.appendFile.spec.js index 21401bd..3949a4e 100644 --- a/tests/spec/fs.appendFile.spec.js +++ b/tests/spec/fs.appendFile.spec.js @@ -5,7 +5,7 @@ describe('fs.appendFile', function() { beforeEach(function(done) { util.setup(function() { var fs = util.fs(); - fs.writeFile('/myfile', "This is a file.", { encoding: 'utf8' }, function(error) { + fs.writeFile('/myfile', 'This is a file.', { encoding: 'utf8' }, function(error) { if(error) throw error; done(); }); @@ -20,8 +20,8 @@ describe('fs.appendFile', function() { it('should append a utf8 file without specifying utf8 in appendFile', function(done) { var fs = util.fs(); - var contents = "This is a file."; - var more = " Appended."; + var contents = 'This is a file.'; + var more = ' Appended.'; fs.appendFile('/myfile', more, function(error) { if(error) throw error; @@ -36,8 +36,8 @@ describe('fs.appendFile', function() { it('should append a utf8 file with "utf8" option to appendFile', function(done) { var fs = util.fs(); - var contents = "This is a file."; - var more = " Appended."; + var contents = 'This is a file.'; + var more = ' Appended.'; fs.appendFile('/myfile', more, 'utf8', function(error) { if(error) throw error; @@ -52,8 +52,8 @@ describe('fs.appendFile', function() { it('should append a utf8 file with {encoding: "utf8"} option to appendFile', function(done) { var fs = util.fs(); - var contents = "This is a file."; - var more = " Appended."; + var contents = 'This is a file.'; + var more = ' Appended.'; fs.appendFile('/myfile', more, { encoding: 'utf8' }, function(error) { if(error) throw error; @@ -70,12 +70,12 @@ describe('fs.appendFile', function() { var fs = util.fs(); // String and utf8 binary encoded versions of the same thing: - var contents = "This is a file."; + var contents = 'This is a file.'; var binary = new Buffer([84, 104, 105, 115, 32, 105, 115, 32, 97, 32, 102, 105, 108, 101, 46]); - var more = " Appended."; + var more = ' Appended.'; var binary2 = new Buffer([32, 65, 112, 112, 101, 110, 100, 101, 100, 46]); var binary3 = new Buffer([84, 104, 105, 115, 32, 105, 115, 32, 97, 32, 102, 105, 108, 101, 46, - 32, 65, 112, 112, 101, 110, 100, 101, 100, 46]); + 32, 65, 112, 112, 101, 110, 100, 101, 100, 46]); fs.writeFile('/mybinaryfile', binary, function(error) { if(error) throw error; @@ -94,8 +94,8 @@ describe('fs.appendFile', function() { it('should follow symbolic links', function(done) { var fs = util.fs(); - var contents = "This is a file."; - var more = " Appended."; + var contents = 'This is a file.'; + var more = ' Appended.'; fs.symlink('/myfile', '/myFileLink', function (error) { if (error) throw error; @@ -114,7 +114,7 @@ describe('fs.appendFile', function() { it('should work when file does not exist, and create the file', function(done) { var fs = util.fs(); - var contents = "This is a file."; + var contents = 'This is a file.'; fs.appendFile('/newfile', contents, { encoding: 'utf8' }, function(error) { expect(error).not.to.exist; diff --git a/tests/spec/fs.link.spec.js b/tests/spec/fs.link.spec.js index 83eb7a5..a9499c4 100644 --- a/tests/spec/fs.link.spec.js +++ b/tests/spec/fs.link.spec.js @@ -43,7 +43,7 @@ describe('fs.link', function() { it('should create hard link to identical data node', function(done) { var fs = util.fs(); - var contents = "Hello World!"; + var contents = 'Hello World!'; fs.writeFile('/file', contents, function(err) { if(err) throw err; diff --git a/tests/spec/fs.lstat.spec.js b/tests/spec/fs.lstat.spec.js index 788c230..72d826b 100644 --- a/tests/spec/fs.lstat.spec.js +++ b/tests/spec/fs.lstat.spec.js @@ -16,7 +16,7 @@ describe('fs.lstat', function() { fs.lstat('/tmp', function(error, result) { expect(error).to.exist; - expect(error.code).to.equal("ENOENT"); + expect(error.code).to.equal('ENOENT'); expect(result).not.to.exist; done(); }); diff --git a/tests/spec/fs.mkdir.spec.js b/tests/spec/fs.mkdir.spec.js index 37a4652..5dcd154 100644 --- a/tests/spec/fs.mkdir.spec.js +++ b/tests/spec/fs.mkdir.spec.js @@ -15,7 +15,7 @@ describe('fs.mkdir', function() { fs.mkdir('/tmp/mydir', function(error) { expect(error).to.exist; - expect(error.code).to.equal("ENOENT"); + expect(error.code).to.equal('ENOENT'); done(); }); }); @@ -25,7 +25,7 @@ describe('fs.mkdir', function() { fs.mkdir('/', function(error) { expect(error).to.exist; - expect(error.code).to.equal("EEXIST"); + expect(error.code).to.equal('EEXIST'); done(); }); }); diff --git a/tests/spec/fs.open.spec.js b/tests/spec/fs.open.spec.js index d6a102b..5ee7150 100644 --- a/tests/spec/fs.open.spec.js +++ b/tests/spec/fs.open.spec.js @@ -16,7 +16,7 @@ describe('fs.open', function() { fs.open('/tmp/myfile', 'w+', function(error, result) { expect(error).to.exist; - expect(error.code).to.equal("ENOENT"); + expect(error.code).to.equal('ENOENT'); expect(result).not.to.exist; done(); }); @@ -27,7 +27,7 @@ describe('fs.open', function() { fs.open('/myfile', 'r+', function(error, result) { expect(error).to.exist; - expect(error.code).to.equal("ENOENT"); + expect(error.code).to.equal('ENOENT'); expect(result).not.to.exist; done(); }); @@ -40,7 +40,7 @@ describe('fs.open', function() { if(error) throw error; fs.open('/tmp', 'w', function(error, result) { expect(error).to.exist; - expect(error.code).to.equal("EISDIR"); + expect(error.code).to.equal('EISDIR'); expect(result).not.to.exist; done(); }); @@ -54,7 +54,7 @@ describe('fs.open', function() { if(error) throw error; fs.open('/tmp', 'a', function(error, result) { expect(error).to.exist; - expect(error.code).to.equal("EISDIR"); + expect(error.code).to.equal('EISDIR'); expect(result).not.to.exist; done(); }); diff --git a/tests/spec/fs.readdir.spec.js b/tests/spec/fs.readdir.spec.js index 6c55de9..0e9a1ec 100644 --- a/tests/spec/fs.readdir.spec.js +++ b/tests/spec/fs.readdir.spec.js @@ -15,7 +15,7 @@ describe('fs.readdir', function() { fs.readdir('/tmp/mydir', function(error, files) { expect(error).to.exist; - expect(error.code).to.equal("ENOENT"); + expect(error.code).to.equal('ENOENT'); expect(files).not.to.exist; done(); }); diff --git a/tests/spec/fs.readlink.spec.js b/tests/spec/fs.readlink.spec.js index 9929b9c..7d2b6c9 100644 --- a/tests/spec/fs.readlink.spec.js +++ b/tests/spec/fs.readlink.spec.js @@ -15,7 +15,7 @@ describe('fs.readlink', function() { fs.readlink('/tmp/mydir', function(error) { expect(error).to.exist; - expect(error.code).to.equal("ENOENT"); + expect(error.code).to.equal('ENOENT'); done(); }); }); @@ -25,7 +25,7 @@ describe('fs.readlink', function() { fs.readlink('/', function(error) { expect(error).to.exist; - expect(error.code).to.equal("ENOENT"); + expect(error.code).to.equal('ENOENT'); done(); }); }); diff --git a/tests/spec/fs.rmdir.spec.js b/tests/spec/fs.rmdir.spec.js index d8075db..328c972 100644 --- a/tests/spec/fs.rmdir.spec.js +++ b/tests/spec/fs.rmdir.spec.js @@ -15,7 +15,7 @@ describe('fs.rmdir', function() { fs.rmdir('/tmp/mydir', function(error) { expect(error).to.exist; - expect(error.code).to.equal("ENOENT"); + expect(error.code).to.equal('ENOENT'); done(); }); }); @@ -25,7 +25,7 @@ describe('fs.rmdir', function() { fs.rmdir('/', function(error) { expect(error).to.exist; - expect(error.code).to.equal("EBUSY"); + expect(error.code).to.equal('EBUSY'); done(); }); }); @@ -39,7 +39,7 @@ describe('fs.rmdir', function() { if(error) throw error; fs.rmdir('/', function(error) { expect(error).to.exist; - expect(error.code).to.equal("EBUSY"); + expect(error.code).to.equal('EBUSY'); done(); }); }); @@ -57,7 +57,7 @@ describe('fs.rmdir', function() { if(error) throw error; fs.rmdir('/tmp/myfile', function(error) { expect(error).to.exist; - expect(error.code).to.equal("ENOTDIR"); + expect(error.code).to.equal('ENOTDIR'); done(); }); }); @@ -74,7 +74,7 @@ describe('fs.rmdir', function() { if(error) throw error; fs.rmdir('/tmp/myfile', function (error) { expect(error).to.exist; - expect(error.code).to.equal("ENOTDIR"); + expect(error.code).to.equal('ENOTDIR'); done(); }); }); diff --git a/tests/spec/fs.shell.spec.js b/tests/spec/fs.shell.spec.js index 6ce7f44..6492fc4 100644 --- a/tests/spec/fs.shell.spec.js +++ b/tests/spec/fs.shell.spec.js @@ -2,11 +2,11 @@ var Filer = require('../../src'); var util = require('../lib/test-utils.js'); var expect = require('chai').expect; -describe("fs.Shell", function() { +describe('fs.Shell', function() { beforeEach(util.setup); afterEach(util.cleanup); - it("is a function", function(done) { + it('is a function', function(done) { var fs = util.fs(); expect(typeof fs.Shell).to.equal('function'); @@ -25,9 +25,9 @@ describe("fs.Shell", function() { var fs = util.fs(); var sh = new fs.Shell(); - Filer.Shell.prototype.test = "foo"; + Filer.Shell.prototype.test = 'foo'; - expect(sh.test).to.equal("foo"); + expect(sh.test).to.equal('foo'); done(); }); }); diff --git a/tests/spec/fs.spec.js b/tests/spec/fs.spec.js index 91abf21..f2eb3b8 100644 --- a/tests/spec/fs.spec.js +++ b/tests/spec/fs.spec.js @@ -2,11 +2,11 @@ var Filer = require('../../src'); var util = require('../lib/test-utils.js'); var expect = require('chai').expect; -describe("fs", function() { +describe('fs', function() { beforeEach(util.setup); afterEach(util.cleanup); - it("is an object", function() { + it('is an object', function() { var fs = util.fs(); expect(typeof fs).to.equal('object'); expect(fs).to.be.an.instanceof(Filer.FileSystem); diff --git a/tests/spec/fs.stat.spec.js b/tests/spec/fs.stat.spec.js index f14bdee..16ee1bb 100644 --- a/tests/spec/fs.stat.spec.js +++ b/tests/spec/fs.stat.spec.js @@ -15,7 +15,7 @@ describe('fs.stat', function() { fs.stat('/tmp', function(error, result) { expect(error).to.exist; - expect(error.code).to.equal("ENOENT"); + expect(error.code).to.equal('ENOENT'); expect(result).not.to.exist; done(); }); diff --git a/tests/spec/fs.stats.spec.js b/tests/spec/fs.stats.spec.js index c92ecd1..eb53241 100644 --- a/tests/spec/fs.stats.spec.js +++ b/tests/spec/fs.stats.spec.js @@ -274,7 +274,7 @@ describe('fs.stats', function() { expect(stats.name).to.equal(Path.basename(filepath)); done(); }); - }) + }); }); it('should correct return name for an fd', function(done) { @@ -290,7 +290,7 @@ describe('fs.stats', function() { expect(stats.name).to.equal(Path.basename(filepath)); done(); }); - }) + }); }); - }) + }); }); diff --git a/tests/spec/fs.symlink.spec.js b/tests/spec/fs.symlink.spec.js index 7b36d81..1e4e9b1 100644 --- a/tests/spec/fs.symlink.spec.js +++ b/tests/spec/fs.symlink.spec.js @@ -15,7 +15,7 @@ describe('fs.symlink', function() { fs.symlink('/', '/tmp/mydir', function(error) { expect(error).to.exist; - expect(error.code).to.equal("ENOENT"); + expect(error.code).to.equal('ENOENT'); done(); }); }); @@ -25,7 +25,7 @@ describe('fs.symlink', function() { fs.symlink('/tmp', '/', function(error) { expect(error).to.exist; - expect(error.code).to.equal("EEXIST"); + expect(error.code).to.equal('EEXIST'); done(); }); }); diff --git a/tests/spec/fs.truncate.spec.js b/tests/spec/fs.truncate.spec.js index 8c8cfdc..2999779 100644 --- a/tests/spec/fs.truncate.spec.js +++ b/tests/spec/fs.truncate.spec.js @@ -12,14 +12,14 @@ describe('fs.truncate', function() { it('should error when length is negative', function(done) { var fs = util.fs(); - var contents = "This is a file."; + var contents = 'This is a file.'; fs.writeFile('/myfile', contents, function(error) { if(error) throw error; fs.truncate('/myfile', -1, function(error) { expect(error).to.exist; - expect(error.code).to.equal("EINVAL"); + expect(error.code).to.equal('EINVAL'); done(); }); }); @@ -30,7 +30,7 @@ describe('fs.truncate', function() { fs.truncate('/', 0, function(error) { expect(error).to.exist; - expect(error.code).to.equal("EISDIR"); + expect(error.code).to.equal('EISDIR'); done(); }); }); diff --git a/tests/spec/fs.utimes.spec.js b/tests/spec/fs.utimes.spec.js index 671a4be..d663050 100644 --- a/tests/spec/fs.utimes.spec.js +++ b/tests/spec/fs.utimes.spec.js @@ -126,7 +126,7 @@ describe('fs.utimes', function() { fs.fstat(ofd, function (error, stat) { expect(error).not.to.exist; expect(stat.mtime).to.equal(mtime); - done(); + done(); }); }); }); diff --git a/tests/spec/fs.writeFile-readFile.spec.js b/tests/spec/fs.writeFile-readFile.spec.js index 37c4a87..7f2d62c 100644 --- a/tests/spec/fs.writeFile-readFile.spec.js +++ b/tests/spec/fs.writeFile-readFile.spec.js @@ -13,11 +13,11 @@ describe('fs.writeFile, fs.readFile', function() { it('should error when path is wrong to readFile', function(done) { var fs = util.fs(); - var contents = "This is a file."; + var contents = 'This is a file.'; fs.readFile('/no-such-file', 'utf8', function(error, data) { expect(error).to.exist; - expect(error.code).to.equal("ENOENT"); + expect(error.code).to.equal('ENOENT'); expect(data).not.to.exist; done(); }); @@ -25,7 +25,7 @@ describe('fs.writeFile, fs.readFile', function() { it('should write, read a utf8 file without specifying utf8 in writeFile', function(done) { var fs = util.fs(); - var contents = "This is a file."; + var contents = 'This is a file.'; fs.writeFile('/myfile', contents, function(error) { if(error) throw error; @@ -39,7 +39,7 @@ describe('fs.writeFile, fs.readFile', function() { it('should write, read a utf8 file with "utf8" option to writeFile', function(done) { var fs = util.fs(); - var contents = "This is a file."; + var contents = 'This is a file.'; fs.writeFile('/myfile', contents, 'utf8', function(error) { if(error) throw error; @@ -53,7 +53,7 @@ describe('fs.writeFile, fs.readFile', function() { it('should write, read a utf8 file with {encoding: "utf8"} option to writeFile', function(done) { var fs = util.fs(); - var contents = "This is a file."; + var contents = 'This is a file.'; fs.writeFile('/myfile', contents, { encoding: 'utf8' }, function(error) { if(error) throw error; @@ -68,7 +68,7 @@ describe('fs.writeFile, fs.readFile', function() { it('should write, read a binary file', function(done) { var fs = util.fs(); // String and utf8 binary encoded versions of the same thing: - var contents = "This is a file."; + var contents = 'This is a file.'; var binary = new Buffer([84, 104, 105, 115, 32, 105, 115, 32, 97, 32, 102, 105, 108, 101, 46]); fs.writeFile('/myfile', binary, function(error) { @@ -83,7 +83,7 @@ describe('fs.writeFile, fs.readFile', function() { it('should follow symbolic links', function(done) { var fs = util.fs(); - var contents = "This is a file."; + var contents = 'This is a file.'; fs.writeFile('/myfile', '', { encoding: 'utf8' }, function(error) { if(error) throw error; diff --git a/tests/spec/fs.xattr.spec.js b/tests/spec/fs.xattr.spec.js index 092939e..c29a4c3 100644 --- a/tests/spec/fs.xattr.spec.js +++ b/tests/spec/fs.xattr.spec.js @@ -288,7 +288,7 @@ describe('fs.xattr', function() { }); }); }); - }) + }); }); }); diff --git a/tests/spec/node-js/simple/test-fs-mkdir.js b/tests/spec/node-js/simple/test-fs-mkdir.js index 389d1d2..f1ffef4 100644 --- a/tests/spec/node-js/simple/test-fs-mkdir.js +++ b/tests/spec/node-js/simple/test-fs-mkdir.js @@ -1,7 +1,7 @@ var util = require('../../../lib/test-utils.js'); var expect = require('chai').expect; -describe("node.js tests: https://github.com/joyent/node/blob/master/test/simple/test-fs-mkdir.js", function() { +describe('node.js tests: https://github.com/joyent/node/blob/master/test/simple/test-fs-mkdir.js', function() { beforeEach(util.setup); afterEach(util.cleanup); diff --git a/tests/spec/node-js/simple/test-fs-null-bytes.js b/tests/spec/node-js/simple/test-fs-null-bytes.js index 8c51eef..62b9290 100644 --- a/tests/spec/node-js/simple/test-fs-null-bytes.js +++ b/tests/spec/node-js/simple/test-fs-null-bytes.js @@ -1,7 +1,7 @@ var util = require('../../../lib/test-utils.js'); var expect = require('chai').expect; -describe("node.js tests: https://github.com/joyent/node/blob/master/test/simple/test-fs-null-bytes.js", function() { +describe('node.js tests: https://github.com/joyent/node/blob/master/test/simple/test-fs-null-bytes.js', function() { beforeEach(util.setup); afterEach(util.cleanup); @@ -9,7 +9,7 @@ describe("node.js tests: https://github.com/joyent/node/blob/master/test/simple/ var checks = []; var fnCount = 0; var fnTotal = 16; - var expected = "Path must be a string without null bytes."; + var expected = 'Path must be a string without null bytes.'; var fs = util.fs(); // Make sure function fails with null path error in callback. @@ -47,8 +47,8 @@ describe("node.js tests: https://github.com/joyent/node/blob/master/test/simple/ check(fs.appendFile, '/foo\u0000bar'); check(fs.truncate, '/foo\u0000bar'); check(fs.utimes, '/foo\u0000bar', 0, 0); -// Not implemented -// check(fs.realpath, '/foo\u0000bar'); + // Not implemented + // check(fs.realpath, '/foo\u0000bar'); check(fs.chmod, '/foo\u0000bar', '0644'); check(fs.chown, '/foo\u0000bar', 12, 34); diff --git a/tests/spec/node-js/simple/test-fs-watch-recursive.js b/tests/spec/node-js/simple/test-fs-watch-recursive.js index d6b6cfc..52fba8c 100644 --- a/tests/spec/node-js/simple/test-fs-watch-recursive.js +++ b/tests/spec/node-js/simple/test-fs-watch-recursive.js @@ -6,7 +6,7 @@ var expect = require('chai').expect; * fd vs. path) for events, or gives only a portion thereof (e.g., basname), * we give full, abs paths always. */ -describe("node.js tests: https://github.com/joyent/node/blob/master/test/simple/test-fs-watch-recursive.js", function() { +describe('node.js tests: https://github.com/joyent/node/blob/master/test/simple/test-fs-watch-recursive.js', function() { beforeEach(util.setup); afterEach(util.cleanup); diff --git a/tests/spec/node-js/simple/test-fs-watch.js b/tests/spec/node-js/simple/test-fs-watch.js index bb05419..6db48be 100644 --- a/tests/spec/node-js/simple/test-fs-watch.js +++ b/tests/spec/node-js/simple/test-fs-watch.js @@ -9,7 +9,7 @@ var expect = require('chai').expect; var filenameOne = '/watch.txt'; var filenameTwo = '/hasOwnProperty'; -describe("node.js tests: https://github.com/joyent/node/blob/master/test/simple/test-fs-watch.js", function() { +describe('node.js tests: https://github.com/joyent/node/blob/master/test/simple/test-fs-watch.js', function() { beforeEach(util.setup); afterEach(util.cleanup); @@ -56,7 +56,7 @@ describe("node.js tests: https://github.com/joyent/node/blob/master/test/simple/ if(error) throw error; var watcher = fs.watch('/tmp', function(event, filename) { -// TODO: node thinks this should be 'rename', need to add rename along with change. + // TODO: node thinks this should be 'rename', need to add rename along with change. expect(event).to.equal('change'); expect(filename).to.equal('/tmp'); watcher.close(); diff --git a/tests/spec/path-resolution.spec.js b/tests/spec/path-resolution.spec.js index 3ae54a4..b53f932 100644 --- a/tests/spec/path-resolution.spec.js +++ b/tests/spec/path-resolution.spec.js @@ -121,7 +121,7 @@ describe('path resolution', function() { fs.stat('/myfilelink1', function(error, result) { expect(error).to.exist; - expect(error.code).to.equal("ENOENT"); + expect(error.code).to.equal('ENOENT'); expect(result).not.to.exist; done(); }); @@ -212,7 +212,7 @@ describe('path resolution', function() { fs.stat('/mynotdirlink/myfile', function(error, result) { expect(error).to.exist; - expect(error.code).to.equal("ENOTDIR"); + expect(error.code).to.equal('ENOTDIR'); expect(result).not.to.exist; done(); }); diff --git a/tests/spec/providers/providers.base.js b/tests/spec/providers/providers.base.js index 70e1510..217eed7 100644 --- a/tests/spec/providers/providers.base.js +++ b/tests/spec/providers/providers.base.js @@ -8,11 +8,11 @@ var expect = require('chai').expect; */ module.exports = function createProviderTestsFor(providerName, testProvider) { if(!testProvider.isSupported()) { - console.log("Skipping provider tests for `" + providerName +"'--not supported in current environment."); + console.log('Skipping provider tests for `' + providerName +'\'--not supported in current environment.'); return; } - describe("Filer Provider Tests for " + providerName, function() { + describe('Filer Provider Tests for ' + providerName, function() { var _provider; var provider; @@ -29,27 +29,27 @@ module.exports = function createProviderTestsFor(providerName, testProvider) { }); - it("has open, getReadOnlyContext, and getReadWriteContext instance methods", function() { + it('has open, getReadOnlyContext, and getReadWriteContext instance methods', function() { expect(provider.open).to.be.a('function'); expect(provider.getReadOnlyContext).to.be.a('function'); expect(provider.getReadWriteContext).to.be.a('function'); }); - it("should open a new provider database", function(done) { + it('should open a new provider database', function(done) { provider.open(function(error) { expect(error).not.to.exist; done(); }); }); - it("should allow putObject() and getObject()", function(done) { + it('should allow putObject() and getObject()', function(done) { provider.open(function(error, firstAccess) { if(error) throw error; var context = provider.getReadWriteContext(); // Simple JS Object var value = { - a: "a", + a: 'a', b: 1, c: true, d: [1,2,3], @@ -57,10 +57,10 @@ module.exports = function createProviderTestsFor(providerName, testProvider) { e1: ['a', 'b', 'c'] } }; - context.putObject("key", value, function(error) { + context.putObject('key', value, function(error) { if(error) throw error; - context.getObject("key", function(error, result) { + context.getObject('key', function(error, result) { expect(error).not.to.exist; expect(result).to.be.an('object'); expect(result).to.deep.equal(value); @@ -70,17 +70,17 @@ module.exports = function createProviderTestsFor(providerName, testProvider) { }); }); - it("should allow putBuffer() and getBuffer()", function(done) { + it('should allow putBuffer() and getBuffer()', function(done) { provider.open(function(error, firstAccess) { if(error) throw error; var context = provider.getReadWriteContext(); // Filer Buffer var buf = new Buffer([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); - context.putBuffer("key", buf, function(error) { + context.putBuffer('key', buf, function(error) { if(error) throw error; - context.getBuffer("key", function(error, result) { + context.getBuffer('key', function(error, result) { expect(error).not.to.exist; expect(Buffer.isBuffer(result)).to.be.true; expect(result).to.deep.equal(buf); @@ -90,17 +90,17 @@ module.exports = function createProviderTestsFor(providerName, testProvider) { }); }); - it("should allow zero-length Buffers with putBuffer() and getBuffer()", function(done) { + it('should allow zero-length Buffers with putBuffer() and getBuffer()', function(done) { provider.open(function(error, firstAccess) { if(error) throw error; var context = provider.getReadWriteContext(); // Zero-length Filer Buffer var buf = new Buffer(new ArrayBuffer(0)); - context.putBuffer("key", buf, function(error) { + context.putBuffer('key', buf, function(error) { if(error) throw error; - context.getBuffer("key", function(error, result) { + context.getBuffer('key', function(error, result) { expect(error).not.to.exist; expect(Buffer.isBuffer(result)).to.be.true; expect(result).to.deep.equal(buf); @@ -110,19 +110,19 @@ module.exports = function createProviderTestsFor(providerName, testProvider) { }); }); - it("should allow delete()", function(done) { + it('should allow delete()', function(done) { var provider = _provider.provider; provider.open(function(error, firstAccess) { if(error) throw error; var context = provider.getReadWriteContext(); - context.putObject("key", "value", function(error) { + context.putObject('key', 'value', function(error) { if(error) throw error; - context.delete("key", function(error) { + context.delete('key', function(error) { if(error) throw error; - context.getObject("key", function(error, result) { + context.getObject('key', function(error, result) { expect(error).not.to.exist; expect(result).not.to.exist; done(); @@ -132,25 +132,25 @@ module.exports = function createProviderTestsFor(providerName, testProvider) { }); }); - it("should allow clear()", function(done) { + it('should allow clear()', function(done) { provider.open(function(error, firstAccess) { if(error) throw error; var context = provider.getReadWriteContext(); - context.putObject("key1", "value1", function(error) { + context.putObject('key1', 'value1', function(error) { if(error) throw error; - context.putObject("key2", "value2", function(error) { + context.putObject('key2', 'value2', function(error) { if(error) throw error; context.clear(function(err) { if(error) throw error; - context.getObject("key1", function(error, result) { + context.getObject('key1', function(error, result) { if(error) throw error; expect(result).not.to.exist; - context.getObject("key2", function(error, result) { + context.getObject('key2', function(error, result) { if(error) throw error; expect(result).not.to.exist; done(); diff --git a/tests/spec/providers/providers.spec.js b/tests/spec/providers/providers.spec.js index d452f26..d8c45d6 100644 --- a/tests/spec/providers/providers.spec.js +++ b/tests/spec/providers/providers.spec.js @@ -1,28 +1,28 @@ var Filer = require('../../../src'); var expect = require('chai').expect; -describe("Filer.FileSystem.providers", function() { - it("is defined", function() { +describe('Filer.FileSystem.providers', function() { + it('is defined', function() { expect(Filer.FileSystem.providers).to.exist; }); - it("has IndexedDB constructor", function() { + it('has IndexedDB constructor', function() { expect(Filer.FileSystem.providers.IndexedDB).to.be.a('function'); }); - it("has WebSQL constructor", function() { + it('has WebSQL constructor', function() { expect(Filer.FileSystem.providers.WebSQL).to.be.a('function'); }); - it("has Memory constructor", function() { + it('has Memory constructor', function() { expect(Filer.FileSystem.providers.Memory).to.be.a('function'); }); - it("has a Default constructor", function() { + it('has a Default constructor', function() { expect(Filer.FileSystem.providers.Default).to.be.a('function'); }); - it("has Fallback constructor", function() { + it('has Fallback constructor', function() { expect(Filer.FileSystem.providers.Fallback).to.be.a('function'); }); }); diff --git a/tests/spec/shell/cat.spec.js b/tests/spec/shell/cat.spec.js index 4396c6f..333295f 100644 --- a/tests/spec/shell/cat.spec.js +++ b/tests/spec/shell/cat.spec.js @@ -16,7 +16,7 @@ describe('FileSystemShell.cat', function() { shell.cat(null, function(error, data) { expect(error).to.exist; - expect(error.code).to.equal("EINVAL"); + expect(error.code).to.equal('EINVAL'); expect(data).not.to.exist; done(); }); @@ -25,7 +25,7 @@ describe('FileSystemShell.cat', function() { it('should return the contents of a single file', function(done) { var fs = util.fs(); var shell = new fs.Shell(); - var contents = "file contents"; + var contents = 'file contents'; fs.writeFile('/file', contents, function(err) { if(err) throw err; @@ -41,7 +41,7 @@ describe('FileSystemShell.cat', function() { it('should return the contents of multiple files', function(done) { var fs = util.fs(); var shell = new fs.Shell(); - var contents = "file contents"; + var contents = 'file contents'; var contents2 = contents + '\n' + contents; fs.writeFile('/file', contents, function(err) { @@ -62,7 +62,7 @@ describe('FileSystemShell.cat', function() { it('should fail if any of multiple file paths is invalid', function(done) { var fs = util.fs(); var shell = new fs.Shell(); - var contents = "file contents"; + var contents = 'file contents'; var contents2 = contents + '\n' + contents; fs.writeFile('/file', contents, function(err) { @@ -73,7 +73,7 @@ describe('FileSystemShell.cat', function() { shell.cat(['/file', '/nofile'], function(err, data) { expect(err).to.exist; - expect(err.code).to.equal("ENOENT"); + expect(err.code).to.equal('ENOENT'); expect(data).not.to.exist; done(); }); diff --git a/tests/spec/shell/env.spec.js b/tests/spec/shell/env.spec.js index c4e16fa..22a5e4a 100644 --- a/tests/spec/shell/env.spec.js +++ b/tests/spec/shell/env.spec.js @@ -37,7 +37,7 @@ describe('FileSystemShell.env', function() { shell.cat(null, function(error, list) { expect(error).to.exist; - expect(error.code).to.equal("EINVAL"); + expect(error.code).to.equal('EINVAL'); expect(list).not.to.exist; done(); }); diff --git a/tests/spec/shell/exec.spec.js b/tests/spec/shell/exec.spec.js index 1044c9b..b9e8b4f 100644 --- a/tests/spec/shell/exec.spec.js +++ b/tests/spec/shell/exec.spec.js @@ -13,7 +13,7 @@ describe('FileSystemShell.exec', function() { it('should be able to execute a command .js file from the filesystem', function(done) { var fs = util.fs(); var shell = new fs.Shell(); - var cmdString = "fs.writeFile(args[0], args[1], callback);"; + var cmdString = 'fs.writeFile(args[0], args[1], callback);'; fs.writeFile('/cmd.js', cmdString, function(error) { if(error) throw error; diff --git a/tests/spec/shell/ls.spec.js b/tests/spec/shell/ls.spec.js index b453764..a789281 100644 --- a/tests/spec/shell/ls.spec.js +++ b/tests/spec/shell/ls.spec.js @@ -16,7 +16,7 @@ describe('FileSystemShell.ls', function() { shell.cat(null, function(error, list) { expect(error).to.exist; - expect(error.code).to.equal("EINVAL"); + expect(error.code).to.equal('EINVAL'); expect(list).not.to.exist; done(); }); @@ -25,8 +25,8 @@ describe('FileSystemShell.ls', function() { it('should return the contents of a simple dir', function(done) { var fs = util.fs(); var shell = new fs.Shell(); - var contents = "a"; - var contents2 = "bb"; + var contents = 'a'; + var contents2 = 'bb'; fs.writeFile('/file', contents, function(err) { if(err) throw err; @@ -63,7 +63,7 @@ describe('FileSystemShell.ls', function() { it('should return the shallow contents of a dir tree', function(done) { var fs = util.fs(); var shell = new fs.Shell(); - var contents = "a"; + var contents = 'a'; fs.mkdir('/dir', function(err) { if(err) throw err; @@ -119,7 +119,7 @@ describe('FileSystemShell.ls', function() { it('should return the deep contents of a dir tree', function(done) { var fs = util.fs(); var shell = new fs.Shell(); - var contents = "a"; + var contents = 'a'; fs.mkdir('/dir', function(err) { if(err) throw err; diff --git a/tests/spec/shell/rm.spec.js b/tests/spec/shell/rm.spec.js index 1e7d635..116d871 100644 --- a/tests/spec/shell/rm.spec.js +++ b/tests/spec/shell/rm.spec.js @@ -16,7 +16,7 @@ describe('FileSystemShell.rm', function() { shell.rm(null, function(error, list) { expect(error).to.exist; - expect(error.code).to.equal("EINVAL"); + expect(error.code).to.equal('EINVAL'); expect(list).not.to.exist; done(); }); @@ -25,7 +25,7 @@ describe('FileSystemShell.rm', function() { it('should remove a single file', function(done) { var fs = util.fs(); var shell = new fs.Shell(); - var contents = "a"; + var contents = 'a'; fs.writeFile('/file', contents, function(err) { if(err) throw err; @@ -106,7 +106,7 @@ describe('FileSystemShell.rm', function() { it('should work on a complex dir structure', function(done) { var fs = util.fs(); var shell = new fs.Shell(); - var contents = "a"; + var contents = 'a'; fs.mkdir('/dir', function(err) { if(err) throw err; diff --git a/tests/spec/time-flags.spec.js b/tests/spec/time-flags.spec.js index e5d856a..1bfe120 100644 --- a/tests/spec/time-flags.spec.js +++ b/tests/spec/time-flags.spec.js @@ -4,8 +4,8 @@ var expect = require('chai').expect; describe('node times (atime, mtime, ctime) with mount flags', function() { - var dirname = "/dir"; - var filename = "/dir/file"; + var dirname = '/dir'; + var filename = '/dir/file'; function memoryFS(flags, callback) { var name = util.uniqueName(); diff --git a/tests/spec/times.spec.js b/tests/spec/times.spec.js index df6178f..5b112fb 100644 --- a/tests/spec/times.spec.js +++ b/tests/spec/times.spec.js @@ -6,8 +6,8 @@ describe('node times (atime, mtime, ctime)', function() { beforeEach(util.setup); afterEach(util.cleanup); - var dirname = "/dir"; - var filename = "/dir/file"; + var dirname = '/dir'; + var filename = '/dir/file'; function createTree(callback) { var fs = util.fs(); @@ -287,7 +287,7 @@ describe('node times (atime, mtime, ctime)', function() { }); it('should update ctime, atime, mtime of parent dir when calling fs.mkdir()', function(done) { - var fs = util.fs(); + var fs = util.fs(); createTree(function() { stat('/', function(stats1) {