1
1
// Test default next-on-netlify configuration
2
2
3
- const { parse, join, sep } = require ( 'path' )
3
+ const { parse, join } = require ( 'path' )
4
4
const { existsSync, readdirSync, readFileSync, readJsonSync } = require ( 'fs-extra' )
5
5
const buildNextApp = require ( './helpers/buildNextApp' )
6
6
@@ -39,19 +39,19 @@ describe('next-on-netlify', () => {
39
39
describe ( 'next-on-netlify' , ( ) => {
40
40
test ( 'builds successfully' , ( ) => {
41
41
expect ( buildOutput ) . toMatch ( 'Next on Netlify' )
42
- expect ( buildOutput ) . toMatch ( `Copying public${ sep } folder to out_publish${ sep } ` )
43
- expect ( buildOutput ) . toMatch ( `Copying static NextJS assets to out_publish${ sep } ` )
44
- expect ( buildOutput ) . toMatch ( `Setting up API endpoints as Netlify Functions in out_functions${ sep } ` )
45
- expect ( buildOutput ) . toMatch ( `Setting up pages with getInitialProps as Netlify Functions in out_functions${ sep } ` )
46
- expect ( buildOutput ) . toMatch ( `Setting up pages with getServerSideProps as Netlify Functions in out_functions${ sep } ` )
47
- expect ( buildOutput ) . toMatch ( `Copying pre-rendered pages with getStaticProps and JSON data to out_publish${ sep } ` )
42
+ expect ( buildOutput ) . toMatch ( `Copying public folder to out_publish` )
43
+ expect ( buildOutput ) . toMatch ( `Copying static NextJS assets to out_publish` )
44
+ expect ( buildOutput ) . toMatch ( `Setting up API endpoints as Netlify Functions in out_functions` )
45
+ expect ( buildOutput ) . toMatch ( `Setting up pages with getInitialProps as Netlify Functions in out_functions` )
46
+ expect ( buildOutput ) . toMatch ( `Setting up pages with getServerSideProps as Netlify Functions in out_functions` )
47
+ expect ( buildOutput ) . toMatch ( `Copying pre-rendered pages with getStaticProps and JSON data to out_publish` )
48
48
expect ( buildOutput ) . toMatch (
49
- `Setting up pages with getStaticProps and fallback: true as Netlify Functions in out_functions${ sep } ` ,
49
+ `Setting up pages with getStaticProps and fallback: true as Netlify Functions in out_functions` ,
50
50
)
51
51
expect ( buildOutput ) . toMatch (
52
- `Setting up pages with getStaticProps and revalidation interval as Netlify Functions in out_functions${ sep } ` ,
52
+ `Setting up pages with getStaticProps and revalidation interval as Netlify Functions in out_functions` ,
53
53
)
54
- expect ( buildOutput ) . toMatch ( `Copying pre-rendered pages without props to out_publish${ sep } ` )
54
+ expect ( buildOutput ) . toMatch ( `Copying pre-rendered pages without props to out_publish` )
55
55
expect ( buildOutput ) . toMatch ( 'Setting up redirects' )
56
56
expect ( buildOutput ) . toMatch ( 'Success! All done!' )
57
57
} )
@@ -68,6 +68,9 @@ describe('SSR Pages', () => {
68
68
true ,
69
69
)
70
70
expect ( existsSync ( join ( functionsDir , 'next_getServerSideProps_id' , 'next_getServerSideProps_id.js' ) ) ) . toBe ( true )
71
+ expect (
72
+ readFileSync ( join ( functionsDir , 'next_getServerSideProps_id' , 'nextPage' , 'index.js' ) , 'utf-8' ) ,
73
+ ) . toBe ( `module.exports = require("./pages/getServerSideProps/[id].js")` )
71
74
} )
72
75
} )
73
76
0 commit comments