Added missing ); to mv, started defining tests
This commit is contained in:
parent
d07dd0991d
commit
71d6251ab2
|
@ -457,7 +457,7 @@ define(function(require) {
|
||||||
|
|
||||||
// We're done after relinking all
|
// We're done after relinking all
|
||||||
return;
|
return;
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// If they're different, link the source as a subdir of the destination
|
// If they're different, link the source as a subdir of the destination
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
define(["Filer", "util"], function(Filer, util) {
|
define(["Filer", "util"], function(Filer, util) {
|
||||||
|
|
||||||
describe('FileSystemShell.mv'), function() {
|
describe('FileSystemShell.mv', function() {
|
||||||
beforeEach(util.setup);
|
beforeEach(util.setup);
|
||||||
afterEach(util.cleanup);
|
afterEach(util.cleanup);
|
||||||
|
|
||||||
|
@ -9,6 +9,70 @@ define(["Filer", "util"], function(Filer, util) {
|
||||||
expect(shell.mv).to.be.a('function');
|
expect(shell.mv).to.be.a('function');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should fail when source argument is absent', function(done) {
|
||||||
|
var fs = util.fs();
|
||||||
|
var shell = fs.Shell();
|
||||||
|
|
||||||
|
shell.mv(null, null, function(error) {
|
||||||
|
expect(error).to.exist;
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should fail when destination argument is absent', function(done) {
|
||||||
|
var fs = util.fs();
|
||||||
|
var shell = fs.Shell();
|
||||||
|
var contents = "a";
|
||||||
|
|
||||||
|
fs.writeFile('/file', contents, function(error) {
|
||||||
|
if(error) throw error;
|
||||||
|
|
||||||
|
shell.mv('/file', null, function(error) {
|
||||||
|
expect(error).to.exist;
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should fail when source argument does not exist', function(done) {
|
||||||
|
var fs = util.fs();
|
||||||
|
var shell = fs.Shell();
|
||||||
|
|
||||||
|
shell.mv('/file', '/dir', function(error) {
|
||||||
|
expect(error).to.exist;
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should move a file to a destination which does not currently exist', function(done) {
|
||||||
|
var fs = util.fs();
|
||||||
|
var shell = fs.Shell();
|
||||||
|
var contents = "a";
|
||||||
|
|
||||||
|
fs.writeFile('/file', contents, function(error) {
|
||||||
|
if(error) throw error;
|
||||||
|
|
||||||
|
shell.mv('/file', '/dir/newfile', function(error) {
|
||||||
|
expect(error).not.to.exist;
|
||||||
|
fs.stat('/file', function(error, stats) {
|
||||||
|
expect(error).to.exist;
|
||||||
|
expect(stats).not.to.exist;
|
||||||
|
fs.stat('/dir/newfile', function(error, stats) {
|
||||||
|
expect(error).not.to.exist;
|
||||||
|
expect(stats).to.exist;
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should move a file into an empty directory', function(done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should move a file into a directory that has a file of the same name', function(done) {
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
Loading…
Reference in New Issue