mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-06 21:10:38 +00:00
test: flatRoutes
This commit is contained in:
parent
89bdd71591
commit
e4593e295d
@ -197,6 +197,25 @@ describe('utils', () => {
|
|||||||
const chainedFn = Utils.chainFn(firstFn, secondFn)
|
const chainedFn = Utils.chainFn(firstFn, secondFn)
|
||||||
expect(chainedFn({}, 10)).toEqual({ foo: 11, bar: 12 })
|
expect(chainedFn({}, 10)).toEqual({ foo: 11, bar: 12 })
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('flatRoutes', () => {
|
||||||
|
const routes = Utils.flatRoutes([
|
||||||
|
{ name: 'login', path: '/login' },
|
||||||
|
{ name: 'about', path: '/about' },
|
||||||
|
{ name: 'posts',
|
||||||
|
path: '',
|
||||||
|
children: [
|
||||||
|
{ name: 'posts-list',
|
||||||
|
path: ''
|
||||||
|
},
|
||||||
|
{ name: 'posts-create',
|
||||||
|
path: 'post'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
])
|
||||||
|
expect(routes).toMatchObject([ '/login', '/about', '', '/post' ])
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
test('createRoutes should allow snake case routes', () => {
|
test('createRoutes should allow snake case routes', () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user