Fixes to pass 0.43 migration test

This commit is contained in:
David Humphrey (:humph) david.humphrey@senecacollege.ca 2018-12-18 10:50:46 -05:00 committed by David Humphrey
parent d0178539f5
commit b5fe85caaa
2 changed files with 11 additions and 7 deletions

View File

@ -185,10 +185,15 @@ function find_node(context, path, callback) {
var parentPath = dirname(path); var parentPath = dirname(path);
var followedCount = 0; var followedCount = 0;
function read_root_directory_node(error, superNode) { function read_root_directory_node(error, nodeData) {
if(error) { if(error) {
callback(error); return callback(error);
} else if(!superNode || superNode.type !== NODE_TYPE_META || !superNode.rnode) { }
// Parse existing node as SuperNode
const superNode = new SuperNode(nodeData);
if(!superNode || superNode.type !== NODE_TYPE_META || !superNode.rnode) {
callback(new Errors.EFILESYSTEMERROR()); callback(new Errors.EFILESYSTEMERROR());
} else { } else {
context.getObject(superNode.rnode, check_root_directory_node); context.getObject(superNode.rnode, check_root_directory_node);

View File

@ -40,8 +40,7 @@ describe('Migration tests from Filer 0.43 to current', () => {
if(err) throw err; if(err) throw err;
expect(entries).to.be.an('array'); expect(entries).to.be.an('array');
expect(entries.length).to.equal(3); expect(entries.length).to.equal(2);
expect(entries).to.contain('README.md');
expect(entries).to.contain('file.txt'); expect(entries).to.contain('file.txt');
expect(entries).to.contain('dir'); expect(entries).to.contain('dir');
done(); done();
@ -80,10 +79,10 @@ describe('Migration tests from Filer 0.43 to current', () => {
nodeFs.readFile(file2TxtPath, null, (err, nodeData) => { nodeFs.readFile(file2TxtPath, null, (err, nodeData) => {
if(err) throw err; if(err) throw err;
filerFs.readFile('/dir/file.txt', null, (err, filerData) => { filerFs.readFile('/dir/file2.txt', null, (err, filerData) => {
if(err) throw err; if(err) throw err;
expect(nodeData).to.equal(filerData); expect(nodeData).to.deep.equal(filerData);
done(); done();
}); });
}); });