hammal/test/handler.ts

24 lines
507 B
TypeScript
Raw Normal View History

2021-04-12 23:12:01 +08:00
import { expect } from 'chai'
import { handleRequest } from '../src/handler'
describe('handler returns response with request method', () => {
const methods = [
'GET',
'HEAD',
'POST',
'PUT',
'DELETE',
'CONNECT',
'OPTIONS',
'TRACE',
'PATCH',
]
methods.forEach((method) => {
it(method, async () => {
const result = await handleRequest(new Request('/', { method }))
const text = await result.text()
expect(text).to.include(method)
})
})
})