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