Skip to content

Commit 0b96aaf

Browse files
EirikBirkelandjennifer-shehane
authored andcommitted
Update stubs-spies-and-clocks.md (#489)
1 parent 05fda82 commit 0b96aaf

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

source/guides/guides/stubs-spies-and-clocks.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ You generally stub a function when it has side effects you are trying to control
7070
- You have a function that accepts a callback, and want to invoke the callback.
7171
- Your function returns a `Promise`, and you want to automatically resolve or reject it.
7272
- You have a function that wraps `window.location` and don't want your application to be navigated.
73-
- You're trying to test your applications "failure path" by forcing things to fail.
74-
- You're trying to test your applications "happy path" by forcing things to pass.
73+
- You're trying to test your application's "failure path" by forcing things to fail.
74+
- You're trying to test your application's "happy path" by forcing things to pass.
7575
- You want to "trick" your application into thinking it's logged in or logged out.
7676
- You're using `oauth` and want to stub login methods.
7777

@@ -81,7 +81,7 @@ You generally stub a function when it has side effects you are trying to control
8181

8282
## Spies
8383

84-
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.
84+
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.
8585

8686
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).
8787

@@ -95,15 +95,15 @@ cy.spy(obj, "method")
9595

9696
## Clock
9797

98-
There are situations when it is useful to control your applications `date` and `time` in order to force its behavior or avoid slow tests.
98+
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.
9999

100100
{% url `cy.clock()` clock %} gives you the ability to control:
101101

102102
- `Date`
103103
- `setTimeout`
104104
- `setInterval`
105105

106-
***Common Scenarios:***
106+
***Common Scenarios***
107107

108108
- You're polling something in your application with `setInterval` and want to control that.
109109
- 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
182182

183183
- We replaced Sinon's argument stringifier for a much less noisy, more performant, custom version.
184184
- We improved the `sinon-chai` assertion output by changing what displays during a passing vs failing test.
185-
- We've added aliasing support to `stub` and `spy` API's.
185+
- We added aliasing support to `stub` and `spy` API's.
186186
- We automatically restore and teardown `stub`, `spy`, and `clock` between tests.
187187

188-
We also integrated all of these API's directly into the Command Log so you can visually see what's happening in your application.
188+
We also integrated all of these API's directly into the Command Log, so you can visually see what's happening in your application.
189189

190190
***We visually indicate when:***
191191

@@ -197,11 +197,11 @@ When you use aliasing with the {% url `.as()` as %} command, we also correlate t
197197

198198
When stubs are created by calling the method `.withArgs(...)` we also visually link these together.
199199

200-
When you click on a stub or spy we also output **incredibly** helpful debugging information.
200+
When you click on a stub or spy, we also output **incredibly** helpful debugging information.
201201

202202
***For instance we automatically display:***
203203

204204
- The call count (and total number of calls)
205-
- The arguments without transforming them (they are the real arguments)
205+
- The arguments, without transforming them (they are the real arguments)
206206
- The return value of the function
207207
- The context the function was invoked with

0 commit comments

Comments
 (0)