Skip to content

Commit bc6cfaf

Browse files
committed
add some test for title and description with Scalar provider
1 parent 6efc3fa commit bc6cfaf

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

test/index.test.ts

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ describe('Swagger', () => {
4545
).toBe(true)
4646
})
4747

48-
it('follow title and description', async () => {
48+
it('follow title and description with Swagger-UI provider', async () => {
4949
const app = new Elysia().use(
5050
swagger({
5151
version: '4.5.0',
@@ -75,6 +75,36 @@ describe('Swagger', () => {
7575
).toBe(true)
7676
})
7777

78+
it('follow title and description with Scalar provider', async () => {
79+
const app = new Elysia().use(
80+
swagger({
81+
version: '4.5.0',
82+
provider: 'scalar',
83+
documentation: {
84+
info: {
85+
title: 'Elysia Documentation',
86+
description: 'Herrscher of Human',
87+
version: '1.0.0'
88+
}
89+
}
90+
})
91+
)
92+
93+
await app.modules
94+
95+
const res = await app.handle(req('/swagger')).then((x) => x.text())
96+
97+
expect(res.includes('<title>Elysia Documentation</title>')).toBe(true)
98+
expect(
99+
res.includes(
100+
`<meta
101+
name="description"
102+
content="Herrscher of Human"
103+
/>`
104+
)
105+
).toBe(true)
106+
})
107+
78108
it('use custom path', async () => {
79109
const app = new Elysia().use(
80110
swagger({

0 commit comments

Comments
 (0)