Skip to content

Commit

Permalink
Update routes-manifest test
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Feb 21, 2020
1 parent 2166142 commit dbbfab3
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/integration/dynamic-routing/test/index.test.js
Expand Up @@ -15,6 +15,7 @@ import {
normalizeRegEx,
} from 'next-test-utils'
import cheerio from 'cheerio'
import escapeRegex from 'escape-string-regexp'

jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 2

Expand Down Expand Up @@ -485,13 +486,43 @@ function runTests(dev) {
route.regex = normalizeRegEx(route.regex)
}

for (const route of manifest.dataRoutes) {
route.dataRouteRegex = normalizeRegEx(route.dataRouteRegex)
}

expect(manifest).toEqual({
version: 1,
pages404: true,
basePath: '',
headers: [],
rewrites: [],
redirects: [],
dataRoutes: [
{
dataRouteRegex: normalizeRegEx(
`^\\/_next\\/data\\/${escapeRegex(
buildId
)}\\/p1\\/p2\\/all\\-ssg\\/(.+?)\\.json$`
),
page: '/p1/p2/all-ssg/[...rest]',
},
{
dataRouteRegex: normalizeRegEx(
`^\\/_next\\/data\\/${escapeRegex(
buildId
)}\\/p1\\/p2\\/nested\\-all\\-ssg\\/(.+?)\\.json$`
),
page: '/p1/p2/nested-all-ssg/[...rest]',
},
{
dataRouteRegex: normalizeRegEx(
`^\\/_next\\/data\\/${escapeRegex(
buildId
)}\\/p1\\/p2\\/predefined\\-ssg\\/(.+?)\\.json$`
),
page: '/p1/p2/predefined-ssg/[...rest]',
},
],
dynamicRoutes: [
{
page: '/blog/[name]/comment/[id]',
Expand Down

0 comments on commit dbbfab3

Please sign in to comment.