From 49d48d8c15dc194a9e1bca00b3e4201a45093d1b Mon Sep 17 00:00:00 2001 From: Eirik Birkeland Date: Sat, 31 Mar 2018 00:25:59 +0200 Subject: [PATCH] Update stubs-spies-and-clocks.md --- source/guides/guides/stubs-spies-and-clocks.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/source/guides/guides/stubs-spies-and-clocks.md b/source/guides/guides/stubs-spies-and-clocks.md index c9d11d2633..fbba7c56e3 100644 --- a/source/guides/guides/stubs-spies-and-clocks.md +++ b/source/guides/guides/stubs-spies-and-clocks.md @@ -70,8 +70,8 @@ You generally stub a function when it has side effects you are trying to control - You have a function that accepts a callback, and want to invoke the callback. - Your function returns a `Promise`, and you want to automatically resolve or reject it. - You have a function that wraps `window.location` and don't want your application to be navigated. -- You're trying to test your applications "failure path" by forcing things to fail. -- You're trying to test your applications "happy path" by forcing things to pass. +- You're trying to test your application's "failure path" by forcing things to fail. +- You're trying to test your application's "happy path" by forcing things to pass. - You want to "trick" your application into thinking it's logged in or logged out. - You're using `oauth` and want to stub login methods. @@ -81,7 +81,7 @@ You generally stub a function when it has side effects you are trying to control ## Spies -A spy gives you the ability to "spy" on a function, by being able to capture and then assert that the function was calling with the right arguments, or that the function was called a certain number of times, or even what the return value or context the function was called with. +A spy gives you the ability to "spy" on a function, by being able to capture and then assert that the function was called with the right arguments, or that the function was called a certain number of times, or even what the return value was, or what context the function was called with. A spy does **not** modify the behavior of the function - it is left perfectly intact. A spy is most useful when you are testing the contract between multiple functions and you don't care about the side effects the real function may create (if any). @@ -95,7 +95,7 @@ cy.spy(obj, "method") ## Clock -There are situations when it is useful to control your applications `date` and `time` in order to force its behavior or avoid slow tests. +There are situations when it is useful to control your application's `date` and `time` in order to force its behavior or avoid slow tests. {% url `cy.clock()` clock %} gives you the ability to control: @@ -103,7 +103,7 @@ There are situations when it is useful to control your applications `date` and ` - `setTimeout` - `setInterval` -***Common Scenarios:*** +***Common Scenarios*** - You're polling something in your application with `setInterval` and want to control that. - You have **throttled** or **debounced** functions which you want to control. @@ -182,10 +182,10 @@ Beyond just integrating these tools together we have also extended and improved - We replaced Sinon's argument stringifier for a much less noisy, more performant, custom version. - We improved the `sinon-chai` assertion output by changing what displays during a passing vs failing test. -- We've added aliasing support to `stub` and `spy` API's. +- We added aliasing support to `stub` and `spy` API's. - We automatically restore and teardown `stub`, `spy`, and `clock` between tests. -We also integrated all of these API's directly into the Command Log so you can visually see what's happening in your application. +We also integrated all of these API's directly into the Command Log, so you can visually see what's happening in your application. ***We visually indicate when:*** @@ -197,11 +197,11 @@ When you use aliasing with the {% url `.as()` as %} command, we also correlate t When stubs are created by calling the method `.withArgs(...)` we also visually link these together. -When you click on a stub or spy we also output **incredibly** helpful debugging information. +When you click on a stub or spy, we also output **incredibly** helpful debugging information. ***For instance we automatically display:*** - The call count (and total number of calls) -- The arguments without transforming them (they are the real arguments) +- The arguments, without transforming them (they are the real arguments) - The return value of the function - The context the function was invoked with