File size: 907 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
import { createNext } from 'e2e-utils'
import { NextInstance } from 'e2e-utils'
import { waitFor } from 'next-test-utils'
import webdriver from 'next-webdriver'

describe('getServerSideProps returns notFound: true', () => {
  let next: NextInstance

  beforeAll(async () => {
    next = await createNext({
      files: {
        'pages/index.js': `
        const Home = () => null
        export default Home
        
        export function getServerSideProps() {
          console.log("gssp called")
          return { notFound: true }
        }
        `,
      },
      dependencies: {},
    })
  })
  afterAll(() => next.destroy())

  it('should not poll indefinitely', async () => {
    const browser = await webdriver(next.url, '/')
    await waitFor(3000)
    await browser.close()
    const logOccurrences = next.cliOutput.split('gssp called').length - 1
    expect(logOccurrences).toBe(1)
  })
})