-
Notifications
You must be signed in to change notification settings - Fork 86
/
Copy pathi18n-ssg-root-index.test.js
57 lines (49 loc) · 2.12 KB
/
i18n-ssg-root-index.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Test next-on-netlify when i18n is set in next.config.js (Next 10+)
const { parse, join } = require('path')
const buildNextApp = require('./helpers/buildNextApp')
// The name of this test file (without extension)
const FILENAME = parse(__filename).name
// The directory which will be used for testing.
// We simulate a NextJS app within that directory, with pages, and a
// package.json file.
const PROJECT_PATH = join(__dirname, 'builds', FILENAME)
const DEFAULT_LOCALE = 'en'
// Capture the output to verify successful build
let buildOutput
beforeAll(
async () => {
buildOutput = await buildNextApp()
.forTest(__filename)
.withPages('pages-i18n-ssg-index')
.withNextConfig('next.config.js-with-i18n.js')
.withPackageJson('package.json')
.build()
},
// time out after 180 seconds
180 * 1000,
)
describe('next-on-netlify', () => {
test('builds successfully', () => {
expect(buildOutput).toMatch('Next on Netlify')
expect(buildOutput).toMatch('Success! All done!')
})
})
describe('next-on-netlify', () => {
test('builds successfully', () => {
expect(buildOutput).toMatch('Next on Netlify')
expect(buildOutput).toMatch(`Copying static NextJS assets to out_publish`)
expect(buildOutput).toMatch(`Setting up API endpoints as Netlify Functions in out_functions`)
expect(buildOutput).toMatch(`Setting up pages with getInitialProps as Netlify Functions in out_functions`)
expect(buildOutput).toMatch(`Setting up pages with getServerSideProps as Netlify Functions in out_functions`)
expect(buildOutput).toMatch(`Copying pre-rendered pages with getStaticProps and JSON data to out_publish`)
expect(buildOutput).toMatch(
`Setting up pages with getStaticProps and fallback: true as Netlify Functions in out_functions`,
)
expect(buildOutput).toMatch(
`Setting up pages with getStaticProps and revalidation interval as Netlify Functions in out_functions`,
)
expect(buildOutput).toMatch(`Copying pre-rendered pages without props to out_publish`)
expect(buildOutput).toMatch('Setting up redirects')
expect(buildOutput).toMatch('Success! All done!')
})
})