From 13284fbf8a12c0446bf6ebf1549dd2918d9869fc Mon Sep 17 00:00:00 2001 From: Alexandre Chopin Date: Thu, 9 Feb 2017 01:18:56 +0100 Subject: [PATCH] update test dynamic routes --- test/dynamic-routes.test.js | 74 ++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/test/dynamic-routes.test.js b/test/dynamic-routes.test.js index de3c94e76d..754fd114cb 100644 --- a/test/dynamic-routes.test.js +++ b/test/dynamic-routes.test.js @@ -27,48 +27,48 @@ test('Check .nuxt/router.js', t => { // pages/index.vue t.is(routes[0].path, '/') t.is(routes[0].name, 'index') - // pages/test/index.vue - t.is(routes[1].path, '/test') - t.is(routes[1].name, 'test') - // pages/posts.vue - t.is(routes[2].path, '/posts') - t.is(routes[2].name, 'posts') - t.is(routes[2].children.length, 1) - // pages/posts/_id.vue - t.is(routes[2].children[0].path, ':id?') - t.is(routes[2].children[0].name, 'posts-id') - // pages/parent.vue - t.is(routes[3].path, '/parent') - t.falsy(routes[3].name) // parent route has no name - // pages/parent/*.vue - t.is(routes[3].children.length, 3) // parent has 3 children - t.deepEqual(routes[3].children.map((r) => r.path), ['', 'teub', 'child']) - t.deepEqual(routes[3].children.map((r) => r.name), ['parent', 'parent-teub', 'parent-child']) - // pages/test/users.vue - t.is(routes[4].path, '/test/users') - t.falsy(routes[4].name) // parent route has no name - // pages/test/users/*.vue - t.is(routes[4].children.length, 3) // parent has 3 children - t.deepEqual(routes[4].children.map((r) => r.path), ['', ':id', ':index/teub']) - t.deepEqual(routes[4].children.map((r) => r.name), ['test-users', 'test-users-id', 'test-users-index-teub']) // pages/test/songs/toto.vue - t.is(routes[5].path, '/test/songs/toto') - t.is(routes[5].name, 'test-songs-toto') + t.is(routes[1].path, '/test/songs/toto') + t.is(routes[1].name, 'test-songs-toto') // pages/test/songs/_id.vue - t.is(routes[6].path, '/test/songs/:id?') - t.is(routes[6].name, 'test-songs-id') + t.is(routes[2].path, '/test/songs/:id?') + t.is(routes[2].name, 'test-songs-id') + // pages/test/users.vue + t.is(routes[3].path, '/test/users') + t.falsy(routes[3].name) // parent route has no name + // pages/test/users/*.vue + t.is(routes[3].children.length, 3) // parent has 3 children + t.deepEqual(routes[3].children.map((r) => r.path), ['', ':index/teub', ':id']) + t.deepEqual(routes[3].children.map((r) => r.name), ['test-users', 'test-users-index-teub', 'test-users-id']) // pages/users/_id.vue - t.is(routes[7].path, '/users/:id?') - t.is(routes[7].name, 'users-id') + t.is(routes[4].path, '/users/:id?') + t.is(routes[4].name, 'users-id') // pages/test/_.vue - t.is(routes[8].path, '/test/*') - t.is(routes[8].name, 'test-all') - // pages/_slug.vue - t.is(routes[9].path, '/:slug') - t.is(routes[9].name, 'slug') + t.is(routes[5].path, '/test/*') + t.is(routes[5].name, 'test-all') + // pages/test/index.vue + t.is(routes[6].path, '/test') + t.is(routes[6].name, 'test') + // pages/posts.vue + t.is(routes[7].path, '/posts') + t.is(routes[7].name, 'posts') + t.is(routes[7].children.length, 1) + // pages/posts/_id.vue + t.is(routes[7].children[0].path, ':id?') + t.is(routes[7].children[0].name, 'posts-id') + // pages/parent.vue + t.is(routes[8].path, '/parent') + t.falsy(routes[8].name) // parent route has no name + // pages/parent/*.vue + t.is(routes[8].children.length, 3) // parent has 3 children + t.deepEqual(routes[8].children.map((r) => r.path), ['', 'teub', 'child']) + t.deepEqual(routes[8].children.map((r) => r.name), ['parent', 'parent-teub', 'parent-child']) // pages/_key/_id.vue - t.is(routes[10].path, '/:key/:id?') - t.is(routes[10].name, 'key-id') + t.is(routes[9].path, '/:key/:id?') + t.is(routes[9].name, 'key-id') + // pages/_slug.vue + t.is(routes[10].path, '/:slug') + t.is(routes[10].name, 'slug') // pages/_.vue t.is(routes[11].path, '/*') t.is(routes[11].name, 'all')