MCPcopy Create free account
hub / github.com/Kong/httpsnippet / runCustomFixtures

Function runCustomFixtures

src/fixtures/runCustomFixtures.ts:22–47  ·  view source on GitHub ↗
({ targetId, clientId, tests }: CustomFixture)

Source from the content-addressed store, hash-verified

20}
21
22export 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};

Callers 13

client.test.tsFile · 0.90
client.test.tsFile · 0.90
client.test.tsFile · 0.90
client.test.tsFile · 0.90
client.test.tsFile · 0.90
client.test.tsFile · 0.90
client.test.tsFile · 0.90
client.test.tsFile · 0.90
client.test.tsFile · 0.90
client.test.tsFile · 0.90
client.test.tsFile · 0.90
client.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…