fork of hey-api/openapi-ts because I need some additional things
at feat/skip-token 31 lines 743 B view raw
1import { type FastifyInstance } from 'fastify'; 2import { showPetById } from 'src/client'; 3import { client } from 'src/client/client.gen'; 4import { buildServer } from 'src/server'; 5 6describe('/pet/findByTags', () => { 7 let server: FastifyInstance; 8 9 beforeAll(async () => { 10 server = await buildServer(); 11 await server.listen(); 12 13 // @ts-ignore 14 const baseUrl = `http://localhost:${server.server.address().port}/v3`; 15 client.setConfig({ baseUrl }); 16 }); 17 18 afterAll(async () => { 19 await Promise.all([server.close()]); 20 }); 21 22 test('showPetById', async () => { 23 const result = await showPetById({ 24 client, 25 path: { 26 petId: '123', 27 }, 28 }); 29 expect(result.response.status).toBe(200); 30 }); 31});