When using the TestWorkflowEnvironment, I’m familiar with how to mock activities. But if an activity calls a non-activity function, they typical pattern for mocking modules/functions with jest does not seem to work.
Example
jest.mock('@rbt/transcript/api', () => ({
transcriptGet: jest.fn().mockResolvedValue(Promise.resolve(bear.transcript)),
}));
My best guess is that the mock created in the jest test is running in a separate context from the TestWorkflowEnvironment
. But then how do I inject a non-activity mock there?
This thread has a similar issue but there is no code sample given for the solution.