mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
feat: add load nested fileNode
This commit is contained in:
1 parent
728399938a
commit
cfb23347f8
2 files changed
+48
-4
No files matched your search
@@ -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)
|
||||
})
|
||||
Reference in new issue
Block a user