---
title: "Discussion on \"Difference between mockClear, mockReset, mockRestore in Jest\" | Hashnode"
description: "Discussion on \"Difference between mockClear, mockReset, mockRestore in Jest\". Some questions that came up while working on Jest.\nDifference between mockClear, mockReset, mockRestore\nmockClear clears the call history of a mock.\nconst mockFn = jest.fn();\nmockFn(); // call 1\nmockFn(); // call 2\nexpect(mockFn).toHaveBeenCalledTime..."
url: "https://hashnode.com/posts/difference-between-mockclear-mockreset-mockrestore-in-jest/67741a87a4b8b6b90cc309c6"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Difference between mockClear, mockReset, mockRestore in Jest](https://vijayt.hashnode.dev/difference-between-mockclear-mockreset-mockrestore-in-jest?utm_source=hashnode&utm_medium=feed)

Some questions that came up while working on Jest. Difference between mockClear, mockReset, mockRestore mockClear clears the call history of a mock. const mockFn = jest.fn(); mockFn(); // call 1 mockFn(); // call 2 expect(mockFn).toHaveBeenCalledTime...

Dec 31, 2024 · 1 min read · vijayt.hashnode.dev  
Read the article

-   [#jest](https://hashnode.com/tag/jest)
-   [#react-testing-library](https://hashnode.com/tag/react-testing-library)

## Written by

[Vijay Thirugnanam](https://hashnode.com/@vijayst)

@vijayst · Toronto, Canada

  
[View profile](https://hashnode.com/@vijayst)

Inference Service @ Cerebras

Engineer working in Cerebras. Latest work is Cerebras Inference. I love writing code in React, TypeScript, C++, Python. I spend most of my work hours tinkering with code.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
