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

describe('instrumentation-hook - register-once', () => {
  const { next, skipped } = nextTestSetup({
    files: __dirname,
    skipDeployment: true,
  })

  if (skipped) {
    return
  }

  it('should only register once', async () => {
    await next.fetch('/foo')
    expect(next.cliOutput).toIncludeRepeated('register-log', 1)
  })

  it('should not error when concurrent requests are made', async () => {
    await Promise.all([next.fetch('/foo'), next.fetch('/foo')])
    expect(next.cliOutput).toIncludeRepeated('register-log', 1)
    expect(next.cliOutput).not.toInclude('duplicated-register')
  })
})