mirror of
https://github.com/zoriya/elysia-swagger.git
synced 2025-12-06 00:36:10 +00:00
add some test for title and description with Scalar provider
This commit is contained in:
@@ -45,7 +45,7 @@ describe('Swagger', () => {
|
|||||||
).toBe(true)
|
).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('follow title and description', async () => {
|
it('follow title and description with Swagger-UI provider', async () => {
|
||||||
const app = new Elysia().use(
|
const app = new Elysia().use(
|
||||||
swagger({
|
swagger({
|
||||||
version: '4.5.0',
|
version: '4.5.0',
|
||||||
@@ -75,6 +75,36 @@ describe('Swagger', () => {
|
|||||||
).toBe(true)
|
).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 () => {
|
it('use custom path', async () => {
|
||||||
const app = new Elysia().use(
|
const app = new Elysia().use(
|
||||||
swagger({
|
swagger({
|
||||||
|
|||||||
Reference in New Issue
Block a user