Skip to content
masterclass Buddy

Jest · Module

mockReturnValueOnce

mockReturnValueOnce(value) makes a Jest mock return a chosen value for one call. Chain it for a sequence, then use mockReturnValue(value) as the fallback.

Last updated

Syntax

mockFn.mockReturnValueOnce(value)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • jest.fn()
  • mockFn.mockImplementation()
  • mockFn.mockImplementationOnce()
  • mockFn.mockResolvedValue()
  • mockFn.mockResolvedValueOnce()
  • mockFn.mock.calls

Source: Mock Functions · Jest. Checked 2026-11-03.