RSSAmplifier

the codeartist — programmer and engineer based in Berlin · Apr 25, 2022

Jest mocks are ...different

0
Sign in to vote or save

This site does not allow itself to be embedded. You can still read it on the original site — the toolbar below keeps your place in the directory.

If you want to mock an imported function in Jest in a way that allows you to check if it has been called, you can not do the seemingly straighforward: // mock prefix necessary btw const mockThatFunction = jest.fn(() => 'stuff') jest.mock('@/path/to/module', () => ({ thatFunction: mockThatFunction, })) // ...in test descriptions…

Read on koehr.ing

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.

    Reading · the codeartist — programmer and engineer based in Berlin · RSS Amplifier