From dde57f7b5fb5912a4c3182c93837ece29b270192 Mon Sep 17 00:00:00 2001 From: Vinicius Morais Dutra Date: Wed, 16 Aug 2023 03:20:53 -0300 Subject: [PATCH] docs: incorrect specification to the method jest.replaceProperty (#14388) --- docs/JestObjectAPI.md | 2 +- website/versioned_docs/version-29.4/JestObjectAPI.md | 2 +- website/versioned_docs/version-29.5/JestObjectAPI.md | 2 +- website/versioned_docs/version-29.6/JestObjectAPI.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/JestObjectAPI.md b/docs/JestObjectAPI.md index 130e6d7768a2..16f20416fdc8 100644 --- a/docs/JestObjectAPI.md +++ b/docs/JestObjectAPI.md @@ -669,7 +669,7 @@ Creates a mock function similar to `jest.fn` but also tracks calls to `object[me :::note -By default, `jest.spyOn` also calls the **spied** method. This is different behavior from most other test libraries. If you want to overwrite the original function, you can use `jest.spyOn(object, methodName).mockImplementation(() => customImplementation)` or `jest.replaceProperty(object, methodName, jest.fn(() => customImplementation));` +By default, `jest.spyOn` also calls the **spied** method. This is different behavior from most other test libraries. If you want to overwrite the original function, you can use `jest.spyOn(object, methodName).mockImplementation(() => customImplementation)` or `object[methodName] = jest.fn(() => customImplementation)`. ::: diff --git a/website/versioned_docs/version-29.4/JestObjectAPI.md b/website/versioned_docs/version-29.4/JestObjectAPI.md index 1a415aa24b87..104d8332d377 100644 --- a/website/versioned_docs/version-29.4/JestObjectAPI.md +++ b/website/versioned_docs/version-29.4/JestObjectAPI.md @@ -669,7 +669,7 @@ Creates a mock function similar to `jest.fn` but also tracks calls to `object[me :::note -By default, `jest.spyOn` also calls the **spied** method. This is different behavior from most other test libraries. If you want to overwrite the original function, you can use `jest.spyOn(object, methodName).mockImplementation(() => customImplementation)` or `jest.replaceProperty(object, methodName, jest.fn(() => customImplementation));` +By default, `jest.spyOn` also calls the **spied** method. This is different behavior from most other test libraries. If you want to overwrite the original function, you can use `jest.spyOn(object, methodName).mockImplementation(() => customImplementation)` or `object[methodName] = jest.fn(() => customImplementation)`. ::: diff --git a/website/versioned_docs/version-29.5/JestObjectAPI.md b/website/versioned_docs/version-29.5/JestObjectAPI.md index 130e6d7768a2..16f20416fdc8 100644 --- a/website/versioned_docs/version-29.5/JestObjectAPI.md +++ b/website/versioned_docs/version-29.5/JestObjectAPI.md @@ -669,7 +669,7 @@ Creates a mock function similar to `jest.fn` but also tracks calls to `object[me :::note -By default, `jest.spyOn` also calls the **spied** method. This is different behavior from most other test libraries. If you want to overwrite the original function, you can use `jest.spyOn(object, methodName).mockImplementation(() => customImplementation)` or `jest.replaceProperty(object, methodName, jest.fn(() => customImplementation));` +By default, `jest.spyOn` also calls the **spied** method. This is different behavior from most other test libraries. If you want to overwrite the original function, you can use `jest.spyOn(object, methodName).mockImplementation(() => customImplementation)` or `object[methodName] = jest.fn(() => customImplementation)`. ::: diff --git a/website/versioned_docs/version-29.6/JestObjectAPI.md b/website/versioned_docs/version-29.6/JestObjectAPI.md index 130e6d7768a2..16f20416fdc8 100644 --- a/website/versioned_docs/version-29.6/JestObjectAPI.md +++ b/website/versioned_docs/version-29.6/JestObjectAPI.md @@ -669,7 +669,7 @@ Creates a mock function similar to `jest.fn` but also tracks calls to `object[me :::note -By default, `jest.spyOn` also calls the **spied** method. This is different behavior from most other test libraries. If you want to overwrite the original function, you can use `jest.spyOn(object, methodName).mockImplementation(() => customImplementation)` or `jest.replaceProperty(object, methodName, jest.fn(() => customImplementation));` +By default, `jest.spyOn` also calls the **spied** method. This is different behavior from most other test libraries. If you want to overwrite the original function, you can use `jest.spyOn(object, methodName).mockImplementation(() => customImplementation)` or `object[methodName] = jest.fn(() => customImplementation)`. :::