11// Test default next-on-netlify configuration
22
3- const { parse, join, sep } = require ( 'path' )
3+ const { parse, join } = require ( 'path' )
44const { existsSync, readdirSync, readFileSync, readJsonSync } = require ( 'fs-extra' )
55const buildNextApp = require ( './helpers/buildNextApp' )
66
@@ -39,19 +39,19 @@ describe('next-on-netlify', () => {
3939describe ( 'next-on-netlify' , ( ) => {
4040 test ( 'builds successfully' , ( ) => {
4141 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` )
4848 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` ,
5050 )
5151 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` ,
5353 )
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` )
5555 expect ( buildOutput ) . toMatch ( 'Setting up redirects' )
5656 expect ( buildOutput ) . toMatch ( 'Success! All done!' )
5757 } )
@@ -68,6 +68,9 @@ describe('SSR Pages', () => {
6868 true ,
6969 )
7070 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")` )
7174 } )
7275} )
7376
0 commit comments