forked from github/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.js
More file actions
19 lines (15 loc) · 621 Bytes
/
Copy pathapi.js
File metadata and controls
19 lines (15 loc) · 621 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { describe, expect, test, vi } from 'vitest'
import { get } from '@/tests/helpers/e2etest'
describe('general /api pages', () => {
vi.setConfig({ testTimeout: 60 * 1000 })
test("any /api URL that isn't found should JSON", async () => {
const res = await get('/api')
expect(res.statusCode).toBe(404)
expect(res.headers['content-type']).toMatch(/application\/json/)
})
test("any /api/* URL that isn't found should be JSON", async () => {
const res = await get('/api/yadayada')
expect(res.statusCode).toBe(404)
expect(JSON.parse(res.body).error).toBe('/yadayada not found')
})
})