-
Notifications
You must be signed in to change notification settings - Fork 26k
/
index.test.ts
35 lines (30 loc) · 1.03 KB
/
index.test.ts
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
/* eslint-env jest */
import { join } from 'path'
import { createNext, FileRef } from 'e2e-utils'
import { NextInstance } from 'test/lib/next-modes/base'
import { fetchViaHTTP } from 'next-test-utils'
const appDir = join(__dirname, '../app')
describe('should set-up next', () => {
let next: NextInstance
beforeAll(async () => {
next = await createNext({
files: {
pages: new FileRef(join(appDir, 'pages')),
'middleware.ts': new FileRef(join(appDir, 'middleware.ts')),
'tsconfig.json': new FileRef(join(appDir, 'tsconfig.json')),
'next.config.js': new FileRef(join(appDir, 'next.config.js')),
},
dependencies: {
typescript: '4.7.4',
'@types/node': 'latest',
'@types/react': 'latest',
'@types/react-dom': 'latest',
},
})
})
afterAll(() => next.destroy())
it('should have built and started', async () => {
const response = await fetchViaHTTP(next.url, '/static')
expect(response.headers.get('data')).toEqual('hello from middleware')
})
})