File size: 1,098 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import { nextTestSetup, FileRef } from 'e2e-utils'
import { join } from 'path'

// x-ref: https://github.com/vercel/next.js/issues/45189
describe('edge render - custom _document with edge runtime', () => {
  const { next } = nextTestSetup({
    files: {
      'pages/index.js': new FileRef(
        join(__dirname, 'app', 'pages', 'index.js')
      ),
      'next.config.js': new FileRef(join(__dirname, 'app', 'next.config.js')),
      'pages/_document.js': `
        import Document, { Html, Head, Main, NextScript } from 'next/document'
        export default class MyDocument extends Document {
          render() {
            return (
              <Html>
                <Head />
                <body>
                  <Main />
                  <NextScript />
                </body>
              </Html>
            )
          }
        }

        export const config = {
          runtime: 'experimental-edge',
        }
      `,
    },
  })

  it('should render page properly', async () => {
    const $ = await next.render$('/')
    expect($('#page').text()).toBe('/index')
  })
})