({ targetId, clientId, tests }: CustomFixture)
| 20 | } |
| 21 | |
| 22 | export const runCustomFixtures = ({ targetId, clientId, tests }: CustomFixture) => { |
| 23 | describe(`custom fixtures for ${targetId}:${clientId}`, () => { |
| 24 | tests.forEach(({ it: title, expected: fixtureFile, options, input: request }) => { |
| 25 | const result = new HTTPSnippet(request).convert(targetId, clientId, options); |
| 26 | const filePath = path.join( |
| 27 | __dirname, |
| 28 | '..', |
| 29 | 'targets', |
| 30 | targetId, |
| 31 | clientId, |
| 32 | 'fixtures', |
| 33 | fixtureFile, |
| 34 | ); |
| 35 | if (process.env.OVERWRITE_EVERYTHING) { |
| 36 | writeFileSync(filePath, String(result)); |
| 37 | } |
| 38 | |
| 39 | it(title, async () => { |
| 40 | const buffer = await readFile(filePath); |
| 41 | const fixture = String(buffer); |
| 42 | |
| 43 | expect(result).toStrictEqual(fixture); |
| 44 | }); |
| 45 | }); |
| 46 | }); |
| 47 | }; |
no outgoing calls
no test coverage detected
searching dependent graphs…