mirror of
https://github.com/honojs/hono.git
synced 2024-12-01 10:51:01 +00:00
7c87ac68cd
* feat(ci): setup github action to enable ci * feat(ci): enable lint * fix(lint): fix critical code style issues
21 lines
576 B
TypeScript
21 lines
576 B
TypeScript
import makeServiceWorkerEnv from 'service-worker-mock'
|
|
import { Hono, Middleware } from '../src/hono'
|
|
|
|
declare let global: any
|
|
Object.assign(global, makeServiceWorkerEnv())
|
|
|
|
describe('Builtin Middleware', () => {
|
|
const app = new Hono()
|
|
|
|
app.use('*', Middleware.poweredBy())
|
|
app.get('/', () => new Response('root'))
|
|
|
|
it('Builtin Powered By Middleware', async () => {
|
|
const req = new Request('/')
|
|
const res = await app.dispatch(req)
|
|
expect(res).not.toBeNull()
|
|
expect(res.status).toBe(200)
|
|
expect(res.headers.get('X-Powered-By')).toBe('Hono')
|
|
})
|
|
})
|