mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
test: stop mocking env vars in jest.utils (#53985)
This commit is contained in:
committed by
GitHub
parent
87762e9a93
commit
9f71d1c3ac
@@ -7,23 +7,6 @@ import { createUserInput } from './src/utils/create-user';
|
||||
import { examJson } from './__mocks__/exam';
|
||||
import { MONGOHQ_URL } from './src/utils/env';
|
||||
|
||||
jest.mock('./src/utils/env', () => {
|
||||
const createTestConnectionURL = (url: string, dbId: string) =>
|
||||
url.replace(/(.*)(\?.*)/, `$1${dbId}$2`);
|
||||
// There are other properties, and this type is too narrow, but we're only
|
||||
// interested in MONGOHQ_URL here.
|
||||
const actual: {
|
||||
MONGOHQ_URL: string;
|
||||
} = jest.requireActual('./src/utils/env');
|
||||
return {
|
||||
...actual,
|
||||
MONGOHQ_URL: createTestConnectionURL(
|
||||
actual.MONGOHQ_URL,
|
||||
process.env.JEST_WORKER_ID!
|
||||
)
|
||||
};
|
||||
});
|
||||
|
||||
type FastifyTestInstance = Awaited<ReturnType<typeof build>>;
|
||||
|
||||
declare global {
|
||||
|
||||
Reference in New Issue
Block a user