mirror of
https://github.com/ImSingee/hammal.git
synced 2024-12-23 03:29:22 +08:00
24 lines
507 B
TypeScript
24 lines
507 B
TypeScript
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)
|
|
})
|
|
})
|
|
})
|