Skip to content

Commit

Permalink
test(fastify & cors): added missing mock fn in nodejs 12.x for cors f…
Browse files Browse the repository at this point in the history
…ramework tests
  • Loading branch information
H4ad committed Nov 19, 2022
1 parent 9e450df commit 46acb15
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/frameworks/cors.framework.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,22 @@ import { KoaFramework } from '../../src/frameworks/koa';
import { TrpcFramework } from '../../src/frameworks/trpc';
import SpyInstance = jest.SpyInstance;

jest.mock('fastify', () => {
const packages = {
'12.x': 'fastify-3',
latest: 'fastify',
};
const version = process.env.TEST_NODE_VERSION || 'latest';

// Require the original module.
const originalModule = jest.requireActual(packages[version]);

return {
__esModule: true,
...originalModule,
};
});

type CorsTest = {
name: string;
method: string;
Expand Down

0 comments on commit 46acb15

Please sign in to comment.