diff --git a/src/filesystem/implementation.js b/src/filesystem/implementation.js index 8c40def..e8aae47 100644 --- a/src/filesystem/implementation.js +++ b/src/filesystem/implementation.js @@ -185,10 +185,15 @@ function find_node(context, path, callback) { var parentPath = dirname(path); var followedCount = 0; - function read_root_directory_node(error, superNode) { + function read_root_directory_node(error, nodeData) { if(error) { - callback(error); - } else if(!superNode || superNode.type !== NODE_TYPE_META || !superNode.rnode) { + return callback(error); + } + + // Parse existing node as SuperNode + const superNode = new SuperNode(nodeData); + + if(!superNode || superNode.type !== NODE_TYPE_META || !superNode.rnode) { callback(new Errors.EFILESYSTEMERROR()); } else { context.getObject(superNode.rnode, check_root_directory_node); diff --git a/tests/filesystems/migrations/from-0.43.test.js b/tests/filesystems/migrations/from-0.43.test.js index 6baadd0..df3580f 100644 --- a/tests/filesystems/migrations/from-0.43.test.js +++ b/tests/filesystems/migrations/from-0.43.test.js @@ -40,8 +40,7 @@ describe('Migration tests from Filer 0.43 to current', () => { if(err) throw err; expect(entries).to.be.an('array'); - expect(entries.length).to.equal(3); - expect(entries).to.contain('README.md'); + expect(entries.length).to.equal(2); expect(entries).to.contain('file.txt'); expect(entries).to.contain('dir'); done(); @@ -80,10 +79,10 @@ describe('Migration tests from Filer 0.43 to current', () => { nodeFs.readFile(file2TxtPath, null, (err, nodeData) => { if(err) throw err; - filerFs.readFile('/dir/file.txt', null, (err, filerData) => { + filerFs.readFile('/dir/file2.txt', null, (err, filerData) => { if(err) throw err; - expect(nodeData).to.equal(filerData); + expect(nodeData).to.deep.equal(filerData); done(); }); });