()
| 19 | const context: { appPort?: number } = {} |
| 20 | |
| 21 | function runTests() { |
| 22 | it('should parse JSON body', async () => { |
| 23 | appPort = await findPort() |
| 24 | app = await launchApp(appDir, appPort, {}) |
| 25 | const data = await makeRequest() |
| 26 | expect(data).toEqual([{ title: 'Nextjs' }]) |
| 27 | await killApp(app) |
| 28 | }) |
| 29 | |
| 30 | it('should not throw if request body is already parsed in custom middleware', async () => { |
| 31 | await startServer() |
| 32 | const data = await makeRequest() |
| 33 | expect(data).toEqual([{ title: 'Nextjs' }]) |
| 34 | await killApp(server) |
| 35 | }) |
| 36 | |
| 37 | it("should not throw if request's content-type is invalid", async () => { |
| 38 | await startServer() |
| 39 | const status = await makeRequestWithInvalidContentType() |
| 40 | expect(status).toBe(200) |
| 41 | await killApp(server) |
| 42 | }) |
| 43 | } |
| 44 | |
| 45 | async function makeRequest() { |
| 46 | const data = await fetchViaHTTP(appPort, '/api', null, { |
no test coverage detected
searching dependent graphs…