From 1c570b41bc6fa2b10e0af7190c83d7dca99d668b Mon Sep 17 00:00:00 2001 From: wing Date: Wed, 13 Sep 2023 22:08:09 +0100 Subject: docs(guide): fix expect assertion example in guide for `spyOn` (#5294) Fixes example with `spyOn` and assertions. The example failed because the spied function would be called once but the expectation asserted 0 calls. --- docs/guides/test/spy-on.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/guides/test') diff --git a/docs/guides/test/spy-on.md b/docs/guides/test/spy-on.md index 003c05d96..4d4902f9d 100644 --- a/docs/guides/test/spy-on.md +++ b/docs/guides/test/spy-on.md @@ -36,7 +36,7 @@ Once the spy is created, it can be used to write `expect` assertions relating to + test("turtles", ()=>{ + expect(spy).toHaveBeenCalledTimes(0); + leo.sayHi("pizza"); -+ expect(spy).toHaveBeenCalledTimes(0); ++ expect(spy).toHaveBeenCalledTimes(1); + expect(spy.mock.calls).toEqual([[ "pizza" ]]); + }) ``` -- cgit v1.2.3