Update tests
This commit is contained in:
parent
8d824a7f7e
commit
9974d5dbda
|
@ -13,7 +13,6 @@ var FS_NODUPEIDCHECK = Constants.FS_NODUPEIDCHECK;
|
||||||
|
|
||||||
var providers = require('../providers/index.js');
|
var providers = require('../providers/index.js');
|
||||||
|
|
||||||
var Shell = require('../shell/shell.js');
|
|
||||||
var Intercom = require('../../lib/intercom.js');
|
var Intercom = require('../../lib/intercom.js');
|
||||||
var FSWatcher = require('../fs-watcher.js');
|
var FSWatcher = require('../fs-watcher.js');
|
||||||
var Errors = require('../errors.js');
|
var Errors = require('../errors.js');
|
||||||
|
@ -98,9 +97,6 @@ function FileSystem(options, callback) {
|
||||||
// Expose Node's fs.constants to users
|
// Expose Node's fs.constants to users
|
||||||
fs.constants = Constants.fsConstants;
|
fs.constants = Constants.fsConstants;
|
||||||
|
|
||||||
// Expose Shell constructor
|
|
||||||
this.Shell = Shell.bind(undefined, this);
|
|
||||||
|
|
||||||
// Safely expose the list of open files and file
|
// Safely expose the list of open files and file
|
||||||
// descriptor management functions
|
// descriptor management functions
|
||||||
var openFiles = {};
|
var openFiles = {};
|
||||||
|
|
|
@ -2,6 +2,5 @@ module.exports = {
|
||||||
FileSystem: require('./filesystem/interface.js'),
|
FileSystem: require('./filesystem/interface.js'),
|
||||||
Buffer: Buffer,
|
Buffer: Buffer,
|
||||||
Path: require('./path.js'),
|
Path: require('./path.js'),
|
||||||
Errors: require('./errors.js'),
|
Errors: require('./errors.js')
|
||||||
Shell: require('./shell/shell.js')
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,8 +6,7 @@ describe('sh.cd doesn\'t seem to be working from a relative path if I am one or
|
||||||
afterEach(util.cleanup);
|
afterEach(util.cleanup);
|
||||||
|
|
||||||
it('should properly deal with relative paths missing ./ and ../', function(done) {
|
it('should properly deal with relative paths missing ./ and ../', function(done) {
|
||||||
var fs = util.fs();
|
var sh = util.shell();
|
||||||
var sh = new fs.Shell();
|
|
||||||
|
|
||||||
sh.mkdirp('/home/scott', function(err) {
|
sh.mkdirp('/home/scott', function(err) {
|
||||||
if(err) throw err;
|
if(err) throw err;
|
||||||
|
|
|
@ -8,8 +8,7 @@ describe('sh.ls and deep directory trees', function() {
|
||||||
afterEach(util.cleanup);
|
afterEach(util.cleanup);
|
||||||
|
|
||||||
it('should not crash when calling sh.ls() on deep directory layouts', function(done) {
|
it('should not crash when calling sh.ls() on deep directory layouts', function(done) {
|
||||||
var fs = util.fs();
|
var sh = util.shell();
|
||||||
var sh = new fs.Shell();
|
|
||||||
|
|
||||||
var path = '';
|
var path = '';
|
||||||
for(var i=0; i<50; i++) {
|
for(var i=0; i<50; i++) {
|
||||||
|
@ -29,7 +28,7 @@ describe('sh.ls and deep directory trees', function() {
|
||||||
|
|
||||||
it('should not crash when calling sh.ls() on wide directory layouts', function(done) {
|
it('should not crash when calling sh.ls() on wide directory layouts', function(done) {
|
||||||
var fs = util.fs();
|
var fs = util.fs();
|
||||||
var sh = new fs.Shell();
|
var sh = util.shell();
|
||||||
|
|
||||||
var dirName = '/dir';
|
var dirName = '/dir';
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,6 @@ require('./spec/time-flags.spec');
|
||||||
require('./spec/fs.watch.spec');
|
require('./spec/fs.watch.spec');
|
||||||
require('./spec/fs.unwatchFile.spec');
|
require('./spec/fs.unwatchFile.spec');
|
||||||
require('./spec/errors.spec');
|
require('./spec/errors.spec');
|
||||||
require('./spec/fs.shell.spec');
|
|
||||||
require('./spec/fs.chmod.spec');
|
require('./spec/fs.chmod.spec');
|
||||||
require('./spec/fs.chown.spec');
|
require('./spec/fs.chown.spec');
|
||||||
require('./spec/fs.copyFile.spec');
|
require('./spec/fs.copyFile.spec');
|
||||||
|
|
|
@ -3,6 +3,7 @@ var IndexedDBTestProvider = require('./indexeddb.js');
|
||||||
var WebSQLTestProvider = require('./websql.js');
|
var WebSQLTestProvider = require('./websql.js');
|
||||||
var MemoryTestProvider = require('./memory.js');
|
var MemoryTestProvider = require('./memory.js');
|
||||||
var Url = require('url');
|
var Url = require('url');
|
||||||
|
var Shell = require('../../src/shell');
|
||||||
|
|
||||||
var _provider;
|
var _provider;
|
||||||
var _fs;
|
var _fs;
|
||||||
|
@ -108,8 +109,7 @@ function provider() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function shell(options) {
|
function shell(options) {
|
||||||
var _fs = fs();
|
return new Shell(fs(), options);
|
||||||
return new _fs.Shell(options);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanup(callback) {
|
function cleanup(callback) {
|
||||||
|
|
|
@ -10,10 +10,6 @@ describe('Filer', function() {
|
||||||
expect(typeof Filer.FileSystem).to.equal('function');
|
expect(typeof Filer.FileSystem).to.equal('function');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('has Shell constructor', function() {
|
|
||||||
expect(typeof Filer.Shell).to.equal('function');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('must honor the \'FORMAT\' flag', function(done) {
|
it('must honor the \'FORMAT\' flag', function(done) {
|
||||||
var name = 'local-test';
|
var name = 'local-test';
|
||||||
// Because we need to use a bunch of Filer filesystems
|
// Because we need to use a bunch of Filer filesystems
|
||||||
|
|
|
@ -11,8 +11,7 @@ describe('FileSystemShell.cat', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should fail when files argument is absent', function(done) {
|
it('should fail when files argument is absent', function(done) {
|
||||||
var fs = util.fs();
|
var shell = util.shell();
|
||||||
var shell = new fs.Shell();
|
|
||||||
|
|
||||||
shell.cat(null, function(error, data) {
|
shell.cat(null, function(error, data) {
|
||||||
expect(error).to.exist;
|
expect(error).to.exist;
|
||||||
|
@ -24,7 +23,7 @@ describe('FileSystemShell.cat', function() {
|
||||||
|
|
||||||
it('should return the contents of a single file', function(done) {
|
it('should return the contents of a single file', function(done) {
|
||||||
var fs = util.fs();
|
var fs = util.fs();
|
||||||
var shell = new fs.Shell();
|
var shell = util.shell();
|
||||||
var contents = 'file contents';
|
var contents = 'file contents';
|
||||||
|
|
||||||
fs.writeFile('/file', contents, function(err) {
|
fs.writeFile('/file', contents, function(err) {
|
||||||
|
@ -40,7 +39,7 @@ describe('FileSystemShell.cat', function() {
|
||||||
|
|
||||||
it('should return the contents of multiple files', function(done) {
|
it('should return the contents of multiple files', function(done) {
|
||||||
var fs = util.fs();
|
var fs = util.fs();
|
||||||
var shell = new fs.Shell();
|
var shell = util.shell();
|
||||||
var contents = 'file contents';
|
var contents = 'file contents';
|
||||||
var contents2 = contents + '\n' + contents;
|
var contents2 = contents + '\n' + contents;
|
||||||
|
|
||||||
|
@ -61,7 +60,7 @@ describe('FileSystemShell.cat', function() {
|
||||||
|
|
||||||
it('should fail if any of multiple file paths is invalid', function(done) {
|
it('should fail if any of multiple file paths is invalid', function(done) {
|
||||||
var fs = util.fs();
|
var fs = util.fs();
|
||||||
var shell = new fs.Shell();
|
var shell = util.shell();
|
||||||
var contents = 'file contents';
|
var contents = 'file contents';
|
||||||
var contents2 = contents + '\n' + contents;
|
var contents2 = contents + '\n' + contents;
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ describe('FileSystemShell.cd', function() {
|
||||||
|
|
||||||
it('should allow changing the path to a valid dir', function(done) {
|
it('should allow changing the path to a valid dir', function(done) {
|
||||||
var fs = util.fs();
|
var fs = util.fs();
|
||||||
var shell = new fs.Shell();
|
var shell = util.shell();
|
||||||
|
|
||||||
fs.mkdir('/dir', function(err) {
|
fs.mkdir('/dir', function(err) {
|
||||||
if(err) throw err;
|
if(err) throw err;
|
||||||
|
@ -33,7 +33,7 @@ describe('FileSystemShell.cd', function() {
|
||||||
|
|
||||||
it('should fail when changing the path to an invalid dir', function(done) {
|
it('should fail when changing the path to an invalid dir', function(done) {
|
||||||
var fs = util.fs();
|
var fs = util.fs();
|
||||||
var shell = new fs.Shell();
|
var shell = util.shell();
|
||||||
|
|
||||||
fs.mkdir('/dir', function(err) {
|
fs.mkdir('/dir', function(err) {
|
||||||
if(err) throw err;
|
if(err) throw err;
|
||||||
|
@ -50,7 +50,7 @@ describe('FileSystemShell.cd', function() {
|
||||||
|
|
||||||
it('should fail when changing the path to a file', function(done) {
|
it('should fail when changing the path to a file', function(done) {
|
||||||
var fs = util.fs();
|
var fs = util.fs();
|
||||||
var shell = new fs.Shell();
|
var shell = util.shell();
|
||||||
|
|
||||||
fs.writeFile('/file', 'file', function(err) {
|
fs.writeFile('/file', 'file', function(err) {
|
||||||
if(err) throw err;
|
if(err) throw err;
|
||||||
|
@ -67,7 +67,7 @@ describe('FileSystemShell.cd', function() {
|
||||||
|
|
||||||
it('should allow relative paths for a valid dir', function(done) {
|
it('should allow relative paths for a valid dir', function(done) {
|
||||||
var fs = util.fs();
|
var fs = util.fs();
|
||||||
var shell = new fs.Shell();
|
var shell = util.shell();
|
||||||
|
|
||||||
fs.mkdir('/dir', function(err) {
|
fs.mkdir('/dir', function(err) {
|
||||||
if(err) throw err;
|
if(err) throw err;
|
||||||
|
@ -83,7 +83,7 @@ describe('FileSystemShell.cd', function() {
|
||||||
|
|
||||||
it('should allow .. in paths for a valid dir', function(done) {
|
it('should allow .. in paths for a valid dir', function(done) {
|
||||||
var fs = util.fs();
|
var fs = util.fs();
|
||||||
var shell = new fs.Shell();
|
var shell = util.shell();
|
||||||
|
|
||||||
fs.mkdir('/dir', function(err) {
|
fs.mkdir('/dir', function(err) {
|
||||||
if(err) throw err;
|
if(err) throw err;
|
||||||
|
@ -110,7 +110,7 @@ describe('FileSystemShell.cd', function() {
|
||||||
fs.symlink('/dir', '/link', function(error) {
|
fs.symlink('/dir', '/link', function(error) {
|
||||||
if(error) throw error;
|
if(error) throw error;
|
||||||
|
|
||||||
var shell = new fs.Shell();
|
var shell = util.shell();
|
||||||
shell.cd('link', function(error) {
|
shell.cd('link', function(error) {
|
||||||
expect(error).not.to.exist;
|
expect(error).not.to.exist;
|
||||||
expect(shell.pwd()).to.equal('/link');
|
expect(shell.pwd()).to.equal('/link');
|
||||||
|
|
|
@ -32,8 +32,7 @@ describe('FileSystemShell.env', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should fail when dirs argument is absent', function(done) {
|
it('should fail when dirs argument is absent', function(done) {
|
||||||
var fs = util.fs();
|
var shell = util.shell();
|
||||||
var shell = new fs.Shell();
|
|
||||||
|
|
||||||
shell.ls(null, function(error, list) {
|
shell.ls(null, function(error, list) {
|
||||||
expect(error).to.exist;
|
expect(error).to.exist;
|
||||||
|
@ -45,7 +44,7 @@ describe('FileSystemShell.env', function() {
|
||||||
|
|
||||||
it('should give new value for shell.pwd() when cwd changes', function(done) {
|
it('should give new value for shell.pwd() when cwd changes', function(done) {
|
||||||
var fs = util.fs();
|
var fs = util.fs();
|
||||||
var shell = new fs.Shell();
|
var shell = util.shell();
|
||||||
|
|
||||||
fs.mkdir('/dir', function(err) {
|
fs.mkdir('/dir', function(err) {
|
||||||
if(err) throw err;
|
if(err) throw err;
|
||||||
|
@ -60,8 +59,7 @@ describe('FileSystemShell.env', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create/return the default tmp dir', function(done) {
|
it('should create/return the default tmp dir', function(done) {
|
||||||
var fs = util.fs();
|
var shell = util.shell();
|
||||||
var shell = new fs.Shell();
|
|
||||||
|
|
||||||
expect(shell.env.get('TMP')).to.equal('/tmp');
|
expect(shell.env.get('TMP')).to.equal('/tmp');
|
||||||
shell.tempDir(function(err, tmp) {
|
shell.tempDir(function(err, tmp) {
|
||||||
|
@ -75,8 +73,7 @@ describe('FileSystemShell.env', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create/return the tmp dir specified in env.TMP', function(done) {
|
it('should create/return the tmp dir specified in env.TMP', function(done) {
|
||||||
var fs = util.fs();
|
var shell = util.shell({
|
||||||
var shell = new fs.Shell({
|
|
||||||
env: {
|
env: {
|
||||||
TMP: '/tempdir'
|
TMP: '/tempdir'
|
||||||
}
|
}
|
||||||
|
@ -94,8 +91,7 @@ describe('FileSystemShell.env', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should allow repeated calls to tempDir()', function(done) {
|
it('should allow repeated calls to tempDir()', function(done) {
|
||||||
var fs = util.fs();
|
var shell = util.shell();
|
||||||
var shell = new fs.Shell();
|
|
||||||
|
|
||||||
expect(shell.env.get('TMP')).to.equal('/tmp');
|
expect(shell.env.get('TMP')).to.equal('/tmp');
|
||||||
shell.tempDir(function(err, tmp) {
|
shell.tempDir(function(err, tmp) {
|
||||||
|
|
|
@ -12,7 +12,7 @@ describe('FileSystemShell.exec', function() {
|
||||||
|
|
||||||
it('should be able to execute a command .js file from the filesystem', function(done) {
|
it('should be able to execute a command .js file from the filesystem', function(done) {
|
||||||
var fs = util.fs();
|
var fs = util.fs();
|
||||||
var shell = new fs.Shell();
|
var shell = util.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) {
|
fs.writeFile('/cmd.js', cmdString, function(error) {
|
||||||
|
|
|
@ -11,8 +11,7 @@ describe('FileSystemShell.ls', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should fail when dirs argument is absent', function(done) {
|
it('should fail when dirs argument is absent', function(done) {
|
||||||
var fs = util.fs();
|
var shell = util.shell();
|
||||||
var shell = new fs.Shell();
|
|
||||||
|
|
||||||
shell.ls(null, function(error, list) {
|
shell.ls(null, function(error, list) {
|
||||||
expect(error).to.exist;
|
expect(error).to.exist;
|
||||||
|
@ -24,7 +23,7 @@ describe('FileSystemShell.ls', function() {
|
||||||
|
|
||||||
it('should return the contents of a simple dir', function(done) {
|
it('should return the contents of a simple dir', function(done) {
|
||||||
var fs = util.fs();
|
var fs = util.fs();
|
||||||
var shell = new fs.Shell();
|
var shell = util.shell();
|
||||||
var contents = 'a';
|
var contents = 'a';
|
||||||
var contents2 = 'bb';
|
var contents2 = 'bb';
|
||||||
|
|
||||||
|
@ -62,7 +61,7 @@ describe('FileSystemShell.ls', function() {
|
||||||
|
|
||||||
it('should return the shallow contents of a dir tree', function(done) {
|
it('should return the shallow contents of a dir tree', function(done) {
|
||||||
var fs = util.fs();
|
var fs = util.fs();
|
||||||
var shell = new fs.Shell();
|
var shell = util.shell();
|
||||||
var contents = 'a';
|
var contents = 'a';
|
||||||
|
|
||||||
fs.mkdir('/dir', function(err) {
|
fs.mkdir('/dir', function(err) {
|
||||||
|
@ -118,7 +117,7 @@ describe('FileSystemShell.ls', function() {
|
||||||
|
|
||||||
it('should return the deep contents of a dir tree', function(done) {
|
it('should return the deep contents of a dir tree', function(done) {
|
||||||
var fs = util.fs();
|
var fs = util.fs();
|
||||||
var shell = new fs.Shell();
|
var shell = util.shell();
|
||||||
var contents = 'a';
|
var contents = 'a';
|
||||||
|
|
||||||
fs.mkdir('/dir', function(err) {
|
fs.mkdir('/dir', function(err) {
|
||||||
|
|
|
@ -11,8 +11,7 @@ describe('FileSystemShell.mkdirp', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should fail without a path provided', function(done) {
|
it('should fail without a path provided', function(done) {
|
||||||
var fs = util.fs();
|
var shell = util.shell();
|
||||||
var shell = new fs.Shell();
|
|
||||||
|
|
||||||
shell.mkdirp(null, function(err) {
|
shell.mkdirp(null, function(err) {
|
||||||
expect(err).to.exist;
|
expect(err).to.exist;
|
||||||
|
@ -22,8 +21,7 @@ describe('FileSystemShell.mkdirp', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should succeed if provided path is root', function(done) {
|
it('should succeed if provided path is root', function(done) {
|
||||||
var fs = util.fs();
|
var shell = util.shell();
|
||||||
var shell = new fs.Shell();
|
|
||||||
shell.mkdirp('/', function(err) {
|
shell.mkdirp('/', function(err) {
|
||||||
expect(err).to.not.exist;
|
expect(err).to.not.exist;
|
||||||
done();
|
done();
|
||||||
|
@ -32,7 +30,7 @@ describe('FileSystemShell.mkdirp', function() {
|
||||||
|
|
||||||
it('should succeed if the directory exists', function(done) {
|
it('should succeed if the directory exists', function(done) {
|
||||||
var fs = util.fs();
|
var fs = util.fs();
|
||||||
var shell = new fs.Shell();
|
var shell = util.shell();
|
||||||
fs.mkdir('/test', function(err){
|
fs.mkdir('/test', function(err){
|
||||||
expect(err).to.not.exist;
|
expect(err).to.not.exist;
|
||||||
shell.mkdirp('/test',function(err) {
|
shell.mkdirp('/test',function(err) {
|
||||||
|
@ -44,7 +42,7 @@ describe('FileSystemShell.mkdirp', function() {
|
||||||
|
|
||||||
it('fail if a file name is provided', function(done) {
|
it('fail if a file name is provided', function(done) {
|
||||||
var fs = util.fs();
|
var fs = util.fs();
|
||||||
var shell = new fs.Shell();
|
var shell = util.shell();
|
||||||
fs.writeFile('/test.txt', 'test', function(err){
|
fs.writeFile('/test.txt', 'test', function(err){
|
||||||
expect(err).to.not.exist;
|
expect(err).to.not.exist;
|
||||||
shell.mkdirp('/test.txt', function(err) {
|
shell.mkdirp('/test.txt', function(err) {
|
||||||
|
@ -57,7 +55,7 @@ describe('FileSystemShell.mkdirp', function() {
|
||||||
|
|
||||||
it('should succeed on a folder on root (\'/test\')', function(done) {
|
it('should succeed on a folder on root (\'/test\')', function(done) {
|
||||||
var fs = util.fs();
|
var fs = util.fs();
|
||||||
var shell = new fs.Shell();
|
var shell = util.shell();
|
||||||
shell.mkdirp('/test', function(err) {
|
shell.mkdirp('/test', function(err) {
|
||||||
expect(err).to.not.exist;
|
expect(err).to.not.exist;
|
||||||
fs.exists('/test', function(dir){
|
fs.exists('/test', function(dir){
|
||||||
|
@ -69,7 +67,7 @@ describe('FileSystemShell.mkdirp', function() {
|
||||||
|
|
||||||
it('should succeed on a folder with a nonexistant parent (\'/test/test\')', function(done) {
|
it('should succeed on a folder with a nonexistant parent (\'/test/test\')', function(done) {
|
||||||
var fs = util.fs();
|
var fs = util.fs();
|
||||||
var shell = new fs.Shell();
|
var shell = util.shell();
|
||||||
shell.mkdirp('/test/test', function(err) {
|
shell.mkdirp('/test/test', function(err) {
|
||||||
expect(err).to.not.exist;
|
expect(err).to.not.exist;
|
||||||
fs.exists('/test', function(dir1){
|
fs.exists('/test', function(dir1){
|
||||||
|
@ -84,7 +82,7 @@ describe('FileSystemShell.mkdirp', function() {
|
||||||
|
|
||||||
it('should fail on a folder with a file for its parent (\'/test.txt/test\')', function(done) {
|
it('should fail on a folder with a file for its parent (\'/test.txt/test\')', function(done) {
|
||||||
var fs = util.fs();
|
var fs = util.fs();
|
||||||
var shell = new fs.Shell();
|
var shell = util.shell();
|
||||||
fs.writeFile('/test.txt', 'test', function(err){
|
fs.writeFile('/test.txt', 'test', function(err){
|
||||||
expect(err).to.not.exist;
|
expect(err).to.not.exist;
|
||||||
shell.mkdirp('/test.txt/test', function(err) {
|
shell.mkdirp('/test.txt/test', function(err) {
|
||||||
|
|
|
@ -11,8 +11,7 @@ describe('FileSystemShell.rm', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should fail when path argument is absent', function(done) {
|
it('should fail when path argument is absent', function(done) {
|
||||||
var fs = util.fs();
|
var shell = util.shell();
|
||||||
var shell = new fs.Shell();
|
|
||||||
|
|
||||||
shell.rm(null, function(error, list) {
|
shell.rm(null, function(error, list) {
|
||||||
expect(error).to.exist;
|
expect(error).to.exist;
|
||||||
|
@ -24,7 +23,7 @@ describe('FileSystemShell.rm', function() {
|
||||||
|
|
||||||
it('should remove a single file', function(done) {
|
it('should remove a single file', function(done) {
|
||||||
var fs = util.fs();
|
var fs = util.fs();
|
||||||
var shell = new fs.Shell();
|
var shell = util.shell();
|
||||||
var contents = 'a';
|
var contents = 'a';
|
||||||
|
|
||||||
fs.writeFile('/file', contents, function(err) {
|
fs.writeFile('/file', contents, function(err) {
|
||||||
|
@ -44,7 +43,7 @@ describe('FileSystemShell.rm', function() {
|
||||||
|
|
||||||
it('should remove an empty dir', function(done) {
|
it('should remove an empty dir', function(done) {
|
||||||
var fs = util.fs();
|
var fs = util.fs();
|
||||||
var shell = new fs.Shell();
|
var shell = util.shell();
|
||||||
|
|
||||||
fs.mkdir('/dir', function(err) {
|
fs.mkdir('/dir', function(err) {
|
||||||
if(err) throw err;
|
if(err) throw err;
|
||||||
|
@ -63,7 +62,7 @@ describe('FileSystemShell.rm', function() {
|
||||||
|
|
||||||
it('should fail to remove a non-empty dir', function(done) {
|
it('should fail to remove a non-empty dir', function(done) {
|
||||||
var fs = util.fs();
|
var fs = util.fs();
|
||||||
var shell = new fs.Shell();
|
var shell = util.shell();
|
||||||
|
|
||||||
fs.mkdir('/dir', function(err) {
|
fs.mkdir('/dir', function(err) {
|
||||||
if(err) throw err;
|
if(err) throw err;
|
||||||
|
@ -82,7 +81,7 @@ describe('FileSystemShell.rm', function() {
|
||||||
|
|
||||||
it('should remove a non-empty dir with option.recursive set', function(done) {
|
it('should remove a non-empty dir with option.recursive set', function(done) {
|
||||||
var fs = util.fs();
|
var fs = util.fs();
|
||||||
var shell = new fs.Shell();
|
var shell = util.shell();
|
||||||
|
|
||||||
fs.mkdir('/dir', function(err) {
|
fs.mkdir('/dir', function(err) {
|
||||||
if(err) throw err;
|
if(err) throw err;
|
||||||
|
@ -105,7 +104,7 @@ describe('FileSystemShell.rm', function() {
|
||||||
|
|
||||||
it('should work on a complex dir structure', function(done) {
|
it('should work on a complex dir structure', function(done) {
|
||||||
var fs = util.fs();
|
var fs = util.fs();
|
||||||
var shell = new fs.Shell();
|
var shell = util.shell();
|
||||||
var contents = 'a';
|
var contents = 'a';
|
||||||
|
|
||||||
fs.mkdir('/dir', function(err) {
|
fs.mkdir('/dir', function(err) {
|
||||||
|
|
|
@ -19,7 +19,7 @@ describe('FileSystemShell.touch', function() {
|
||||||
|
|
||||||
it('should create a new file if path does not exist', function(done) {
|
it('should create a new file if path does not exist', function(done) {
|
||||||
var fs = util.fs();
|
var fs = util.fs();
|
||||||
var shell = new fs.Shell();
|
var shell = util.shell();
|
||||||
|
|
||||||
shell.touch('/newfile', function(error) {
|
shell.touch('/newfile', function(error) {
|
||||||
if(error) throw error;
|
if(error) throw error;
|
||||||
|
@ -34,7 +34,7 @@ describe('FileSystemShell.touch', function() {
|
||||||
|
|
||||||
it('should skip creating a new file if options.updateOnly is true', function(done) {
|
it('should skip creating a new file if options.updateOnly is true', function(done) {
|
||||||
var fs = util.fs();
|
var fs = util.fs();
|
||||||
var shell = new fs.Shell();
|
var shell = util.shell();
|
||||||
|
|
||||||
shell.touch('/newfile', { updateOnly: true }, function(error) {
|
shell.touch('/newfile', { updateOnly: true }, function(error) {
|
||||||
if(error) throw error;
|
if(error) throw error;
|
||||||
|
@ -49,7 +49,7 @@ describe('FileSystemShell.touch', function() {
|
||||||
|
|
||||||
it('should update times if path does exist', function(done) {
|
it('should update times if path does exist', function(done) {
|
||||||
var fs = util.fs();
|
var fs = util.fs();
|
||||||
var shell = new fs.Shell();
|
var shell = util.shell();
|
||||||
var atime = Date.parse('1 Oct 2000 15:33:22');
|
var atime = Date.parse('1 Oct 2000 15:33:22');
|
||||||
var mtime = Date.parse('30 Sep 2000 06:43:54');
|
var mtime = Date.parse('30 Sep 2000 06:43:54');
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ describe('FileSystemShell.touch', function() {
|
||||||
|
|
||||||
it('should update times to specified date if path does exist', function(done) {
|
it('should update times to specified date if path does exist', function(done) {
|
||||||
var fs = util.fs();
|
var fs = util.fs();
|
||||||
var shell = new fs.Shell();
|
var shell = util.shell();
|
||||||
var date = Date.parse('1 Oct 2001 15:33:22');
|
var date = Date.parse('1 Oct 2001 15:33:22');
|
||||||
|
|
||||||
fs.open('/newfile', 'w', function (error, fd) {
|
fs.open('/newfile', 'w', function (error, fd) {
|
||||||
|
|
Loading…
Reference in New Issue