https://jestjs.io/docs/mock-function-api#mockfnmockreturnvalueoncevalue
[Mock Functions · Jest
Mock functions are also known as "spies", because they let you spy on the behavior of a function that is called indirectly by some other code, rather than only testing the output. You can create a mock function with jest.fn(). If no implementation is given
jestjs.io](https://jestjs.io/docs/mock-function-api#mockfnmockreturnvalueoncevalue)
[Jest mock the same function twice with different arguments
I'm new to JEST and I'm currently testing a Javascript component that makes an API call in its onComponentDidMount. Depending on the return data of the ajax call (api call) my component either disp...
stackoverflow.com](https://stackoverflow.com/questions/53887173/jest-mock-the-same-function-twice-with-different-arguments)
jest
의 mockReturnOnce
기능을 이용하면됨
'TIL' 카테고리의 다른 글
S3 CopyObject / Access Deny / the specified key does not exist (0) | 2023.08.03 |
---|---|
prisma 5 update 주요 내용 (0) | 2023.07.12 |
rxjs retry change parameter / rxjs retry 사용시 값 갱신 안됨 (0) | 2023.05.16 |
Class-validator @Transform 사용시 @ValidateNested 동작 안함 ValidatedNested with transform not validating (0) | 2023.04.04 |
eslint : vscode formatOnSave (0) | 2023.02.16 |