add some test for title and description with Scalar provider

This commit is contained in:
inyourtime
2024-10-03 10:02:36 +07:00
parent 6efc3fa642
commit bc6cfafac3

View File

@@ -45,7 +45,7 @@ describe('Swagger', () => {
).toBe(true)
})
it('follow title and description', async () => {
it('follow title and description with Swagger-UI provider', async () => {
const app = new Elysia().use(
swagger({
version: '4.5.0',
@@ -75,6 +75,36 @@ describe('Swagger', () => {
).toBe(true)
})
it('follow title and description with Scalar provider', async () => {
const app = new Elysia().use(
swagger({
version: '4.5.0',
provider: 'scalar',
documentation: {
info: {
title: 'Elysia Documentation',
description: 'Herrscher of Human',
version: '1.0.0'
}
}
})
)
await app.modules
const res = await app.handle(req('/swagger')).then((x) => x.text())
expect(res.includes('<title>Elysia Documentation</title>')).toBe(true)
expect(
res.includes(
`<meta
name="description"
content="Herrscher of Human"
/>`
)
).toBe(true)
})
it('use custom path', async () => {
const app = new Elysia().use(
swagger({