I am trying to mock something that imports @env
so that I can test different combinations of the values. However, I don't want to change the existing method which reads from the @env
to pass in variables.
// env.d.ts
declare module '@env' {
export const APP_ROUTE_NAME: string;
}
Here's my attempt
import env from '@env';
jest.mock('@env');
describe("Determine initial routes", ()=> {
it("defaults",()=>{
// does not work because it is read only
(env as jest.Mocked<typeof env>).APP_ROUTE_NAME = null
})
})