feat: add load nested fileNode

This commit is contained in:
wancat committed 2023-08-29 13:26:14 +08:00
1 parent 728399938a
commit cfb23347f8
2 files changed
+48 -4

No files matched your search

+36
View File
@@ -219,3 +219,39 @@ describe('FileNode', () => {
removeChildTest(files, fileToRemove, expected)
})
})
test('load nested fileNode', () => {
const data = {
path: '/',
type: 'folder',
children: [
{
path: '/a',
type: 'file',
},
{
path: '/b',
type: 'folder',
children: [
{
path: '/b/c',
type: 'folder',
children: [
{
path: '/b/c/d',
type: 'file',
},
],
},
],
},
],
}
const node = new FileNode(data)
console.log(node.toString())
expect(node.children.length).toBe(2)
expect(node.children[1].children.length).toBe(1)
expect(node.children[1].children[0].children.length).toBe(1)
})