mirror of
https://github.com/zoriya/elysia-swagger.git
synced 2025-12-06 00:36:10 +00:00
26 lines
628 B
TypeScript
26 lines
628 B
TypeScript
import KingWorld from 'kingworld'
|
|
|
|
import swagger from '../src'
|
|
|
|
import { describe, expect, it } from 'bun:test'
|
|
|
|
const req = (path: string) => new Request(path)
|
|
|
|
describe('Swagger', () => {
|
|
it('redirect to Swagger page', async () => {
|
|
const app = new KingWorld().use(swagger)
|
|
|
|
const res = await app.handle(req('/swagger'))
|
|
expect(res.status).toBe(302)
|
|
})
|
|
|
|
it('use custom path', async () => {
|
|
const app = new KingWorld().use(swagger, {
|
|
path: '/v2/swagger'
|
|
})
|
|
|
|
const res = await app.handle(req('/v2/swagger'))
|
|
expect(res.status).toBe(302)
|
|
})
|
|
})
|