build(broccoli): reorder tree-differ specs

This commit is contained in:
Igor Minar 2015-05-27 18:30:04 -07:00
parent 05becf8431
commit b14417498a
1 changed files with 31 additions and 31 deletions

View File

@ -297,24 +297,24 @@ describe('TreeDiffer', () => {
let diffResult = differ.diffTree(); let diffResult = differ.diffTree();
expect(diffResult.changedPaths).toEqual(['file-2.txt']); expect(diffResult.changedPaths).toEqual(['file-2.txt']);
}); });
});
it('should detect file additions mixed with file changes', () => { it('should detect file additions mixed with file changes', () => {
let testDir = { let testDir = {
'dir1': {'file-1.txt': mockfs.file({content: 'file-1.txt content', mtime: new Date(1000)})} 'dir1': {'file-1.txt': mockfs.file({content: 'file-1.txt content', mtime: new Date(1000)})}
}; };
mockfs(testDir); mockfs(testDir);
let differ = new TreeDiffer('testLabel', 'dir1'); let differ = new TreeDiffer('testLabel', 'dir1');
differ.diffTree(); differ.diffTree();
testDir['dir1']['file-1.txt'] = 'new content'; testDir['dir1']['file-1.txt'] = 'new content';
testDir['dir1']['file-2.txt'] = 'new file'; testDir['dir1']['file-2.txt'] = 'new file';
mockfs(testDir); mockfs(testDir);
let diffResult = differ.diffTree(); let diffResult = differ.diffTree();
expect(diffResult.changedPaths).toEqual(['file-1.txt', 'file-2.txt']); expect(diffResult.changedPaths).toEqual(['file-1.txt', 'file-2.txt']);
});
}); });
@ -337,29 +337,29 @@ describe('TreeDiffer', () => {
expect(diffResult.changedPaths).toEqual([]); expect(diffResult.changedPaths).toEqual([]);
expect(diffResult.removedPaths).toEqual(['file-1.txt']); expect(diffResult.removedPaths).toEqual(['file-1.txt']);
}); });
});
it('should detect file removals mixed with file changes and additions', () => { it('should detect file removals mixed with file changes and additions', () => {
let testDir = { let testDir = {
'dir1': { 'dir1': {
'file-1.txt': mockfs.file({content: 'file-1.txt content', mtime: new Date(1000)}), 'file-1.txt': mockfs.file({content: 'file-1.txt content', mtime: new Date(1000)}),
'file-2.txt': mockfs.file({content: 'file-1.txt content', mtime: new Date(1000)}) 'file-2.txt': mockfs.file({content: 'file-1.txt content', mtime: new Date(1000)})
} }
}; };
mockfs(testDir); mockfs(testDir);
let differ = new TreeDiffer('testLabel', 'dir1'); let differ = new TreeDiffer('testLabel', 'dir1');
differ.diffTree(); differ.diffTree();
testDir['dir1']['file-1.txt'] = 'changed content'; testDir['dir1']['file-1.txt'] = 'changed content';
delete testDir['dir1']['file-2.txt']; delete testDir['dir1']['file-2.txt'];
testDir['dir1']['file-3.txt'] = 'new content'; testDir['dir1']['file-3.txt'] = 'new content';
mockfs(testDir); mockfs(testDir);
let diffResult = differ.diffTree(); let diffResult = differ.diffTree();
expect(diffResult.changedPaths).toEqual(['file-1.txt', 'file-3.txt']); expect(diffResult.changedPaths).toEqual(['file-1.txt', 'file-3.txt']);
expect(diffResult.removedPaths).toEqual(['file-2.txt']); expect(diffResult.removedPaths).toEqual(['file-2.txt']);
});
}); });
}); });