From bc6cfafac3ad97f554ca1c0f0ce5d82c542447cb Mon Sep 17 00:00:00 2001 From: inyourtime Date: Thu, 3 Oct 2024 10:02:36 +0700 Subject: [PATCH] add some test for title and description with Scalar provider --- test/index.test.ts | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/test/index.test.ts b/test/index.test.ts index 146becc..868be79 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -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('Elysia Documentation')).toBe(true) + expect( + res.includes( + `` + ) + ).toBe(true) + }) + it('use custom path', async () => { const app = new Elysia().use( swagger({