1
0
mirror of synced 2025-12-23 11:54:18 -05:00
Files
docs/tests/rendering/api.js
2022-10-18 17:19:06 +00:00

20 lines
604 B
JavaScript

import { expect, jest, test } from '@jest/globals'
import { get } from '../helpers/e2etest.js'
describe('general /api pages', () => {
jest.setTimeout(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.text).error).toBe('/yadayada not found')
})
})