Skip to content

Commit

Permalink
test: nest raw routes
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Apr 27, 2023
1 parent c04d068 commit af7d1da
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/core/extendRoutes.spec.ts
Expand Up @@ -40,6 +40,20 @@ describe('EditableTreeNode', () => {
expect(tree.children.get('foo/bar')?.path).toBe('/foo/bar')
})

it('can nest routes', () => {
const tree = createPrefixTree(DEFAULT_OPTIONS)
const editable = new EditableTreeNode(tree)

const node = editable.insert('foo', 'file.vue')
node.insert('bar/nested', 'file.vue')
expect(tree.children.size).toBe(1)
expect(node.children.length).toBe(1)
expect(node.fullPath).toBe('/foo')
expect(node.path).toBe('/foo')
expect(node.children.at(0)?.path).toBe('bar/nested')
expect(node.children.at(0)?.fullPath).toBe('/foo/bar/nested')
})

it('can have multiple params', () => {
const tree = createPrefixTree(DEFAULT_OPTIONS)
const editable = new EditableTreeNode(tree)
Expand Down

0 comments on commit af7d1da

Please sign in to comment.