Skip to content

Instantly share code, notes, and snippets.

@oosby
Created September 16, 2019 21:22
Show Gist options
  • Save oosby/564cc01eff72bf30230cd5f75aac3cfa to your computer and use it in GitHub Desktop.
Save oosby/564cc01eff72bf30230cd5f75aac3cfa to your computer and use it in GitHub Desktop.
import { SOME_VALUE } from '../constants';
jest.mock('../constants', () => ({ SOME_VALUE: 'abc123test' }));
@Gianfranco97
Copy link

I love you <3

Simple, but that's what I was looking for

@srivsaks
Copy link

Perfect!

@mallikarjunasharma
Copy link

awesome

@FrancisZhuang
Copy link

thanks

@thomasamaddeo-genie
Copy link

what if the value of the constant needs to change across different tests? Is that possible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment