File size: 736 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
import { nextTestSetup } from 'e2e-utils'

describe('app fetch build cache', () => {
  const { next } = nextTestSetup({
    files: __dirname,
  })

  let initialData

  it('should have done initial build', async () => {
    const $ = await next.render$('/')
    expect($('#page').text()).toBe('index page')

    initialData = $('#data').text()
    expect(initialData).toBeTruthy()
  })

  it('should not use stale data if present', async () => {
    await next.stop()

    next.env['NOW_BUILDER'] = '1'
    await next.start()

    const $ = await next.render$('/')
    expect($('#page').text()).toBe('index page')

    const newData = $('#data').text()
    expect(newData).toBeTruthy()
    expect(newData).not.toBe(initialData)
  })
})