Skip to content

Commit

Permalink
test: check uiConfig options are processed by fastify-swagger
Browse files Browse the repository at this point in the history
  • Loading branch information
lazharichir committed May 12, 2021
1 parent 5653ca4 commit 8f323fb
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions e2e/fastify.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,28 @@ describe('Fastify Swagger', () => {
}
});

it('should pass uiConfig options to fastify-swagger', async () => {
const document1 = SwaggerModule.createDocument(app, builder.build());
const uiConfig = {
displayOperationId: true,
persistAuthorization: true
};
const options = { uiConfig };
SwaggerModule.setup('/swagger1', app, document1, options);

const instance = await app.getHttpAdapter().getInstance().ready();

instance.ready(async () => {
const response = await instance.inject({
method: 'GET',
url: '/swagger1/uiConfig'
});

expect(response.statusCode).toEqual(200);
expect(JSON.parse(response.body)).toEqual(uiConfig);
});
});

it('should setup multiple routes', async () => {
const document1 = SwaggerModule.createDocument(app, builder.build());
SwaggerModule.setup('/swagger1', app, document1);
Expand Down

0 comments on commit 8f323fb

Please sign in to comment.