What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-11-07 15:51:18
mock sqs.sendMessage node js
import sendMessage from './'; import AWS from 'aws-sdk'; jest.mock('aws-sdk', () => { const SQSMocked = { sendMessage: jest.fn().mockReturnThis(), promise: jest.fn() }; return { SQS: jest.fn(() => SQSMocked) }; }); const sqs = ... Add solution -
Other 2021-11-06 18:28:13
jest mock method by name
import Foo from './Foo'; import Bar from './Bar'; jest.mock('./Bar'); describe('Foo', () => { it('should return correct foo', () => { // As Bar is already mocked, // we just need to cast it to jest.Mock (for TypeScript) and mock whatever... Add solution