Skip to content

Commit 83ebd6a

Browse files
authored
Merge pull request #282 from randycoulman/add-links-between-docs
Add previous/next links to documentation files
2 parents d5893fb + 8490354 commit 83ebd6a

13 files changed

+106
-64
lines changed

README.md

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -70,66 +70,66 @@ numbered for easy reading in the priority-order we anticipate people needing the
7070
Here's a rough outline:
7171

7272
1. [Installation](docs/1-installation.md#installing-testdoublejs)
73-
1. [for Node.js](docs/1-installation.md#for-use-in-nodejs-or-browserify)
74-
2. [for browsers](docs/1-installation.md#for-use-in-browsers)
75-
3. [initial configuration](docs/1-installation.md#configuring-testdoublejs-setting-up-in-your-test-suite)
76-
2. [Purpose of testdouble.js](docs/2-howto-purpose.md#background)
77-
1. [in unit tests](docs/2-howto-purpose.md#test-doubles-and-unit-tests)
78-
2. [in integration tests](docs/2-howto-purpose.md#test-doubles-and-integration-tests)
73+
1. [for Node.js](docs/1-installation.md#for-use-in-nodejs-or-browserify)
74+
2. [for browsers](docs/1-installation.md#for-use-in-browsers)
75+
3. [initial configuration](docs/1-installation.md#configuring-testdoublejs-setting-up-in-your-test-suite)
76+
2. [Purpose of testdouble.js](docs/2-howto-purpose.md#purpose)
77+
1. [in unit tests](docs/2-howto-purpose.md#test-doubles-and-unit-tests)
78+
2. [in integration tests](docs/2-howto-purpose.md#test-doubles-and-integration-tests)
7979
3. [Getting started tutorial](docs/3-getting-started.md#getting-started)
8080
4. [Creating test doubles](docs/4-creating-test-doubles.md#creating-test-doubles)
81-
1. [test double functions with `td.function()`](docs/4-creating-test-doubles.md#tdfunctionname)
82-
2. [test double objects with `td.object()`](docs/4-creating-test-doubles.md#tdobject)
83-
3. [test double constructors with `td.constructor()`](docs/4-creating-test-doubles.md#tdconstructor)
81+
1. [test double functions with `td.function()`](docs/4-creating-test-doubles.md#tdfunctionname)
82+
2. [test double objects with `td.object()`](docs/4-creating-test-doubles.md#tdobject)
83+
3. [test double constructors with `td.constructor()`](docs/4-creating-test-doubles.md#tdconstructor)
8484
5. [Stubbing responses](docs/5-stubbing-results.md#stubbing-behavior)
85-
1. [td.when() API](docs/5-stubbing-results.md#tdwhen)
86-
2. [equality argument matching](docs/5-stubbing-results.md#simple-precise-argument-stubbing)
87-
3. [one-liner stubbings](docs/5-stubbing-results.md#one-liner-stubbings)
88-
4. [stubbing sequential return values](docs/5-stubbing-results.md#stubbing-sequential-return-values)
89-
5. [argument matchers](docs/5-stubbing-results.md#loosening-stubbings-with-argument-matchers)
90-
1. [td.matchers.anything()](docs/5-stubbing-results.md#tdmatchersanything)
91-
2. [td.matchers.isA()](docs/5-stubbing-results.md#tdmatchersisa)
92-
3. [td.matchers.contains()](docs/5-stubbing-results.md#tdmatcherscontains)
93-
1. [matching strings](docs/5-stubbing-results.md#strings)
94-
2. [matching arrays](docs/5-stubbing-results.md#arrays)
95-
3. [matching objects](docs/5-stubbing-results.md#objects)
96-
4. [td.matchers.argThat()](docs/5-stubbing-results.md#tdmatchersargthat)
97-
5. [td.matchers.not()](docs/5-stubbing-results.md#tdmatchersnot)
98-
6. [Stubbing callback APIs](docs/5-stubbing-results.md#stubbing-callback-apis)
99-
7. [Stub exceptions with thenThrow](docs/5-stubbing-results.md#stub-exceptions-with-thenthrow)
100-
8. [Stub promises with thenResolve and thenReject](docs/5-stubbing-results.md#stub-promises-with-thenresolve-and-thenreject)
101-
9. [Stub side effects with thenDo](docs/5-stubbing-results.md#stub-side-effects-with-thendo)
102-
10. [Configuring stubbings](docs/5-stubbing-results.md#configuring-stubbings)
103-
1. [ignoreExtraArgs](docs/5-stubbing-results.md#ignoreextraargs)
104-
2. [times](docs/5-stubbing-results.md#times)
105-
3. [defer](docs/5-stubbing-results.md#defer)
106-
4. [delay](docs/5-stubbing-results.md#delay)
85+
1. [td.when() API](docs/5-stubbing-results.md#tdwhen)
86+
2. [equality argument matching](docs/5-stubbing-results.md#simple-precise-argument-stubbing)
87+
3. [one-liner stubbings](docs/5-stubbing-results.md#one-liner-stubbings)
88+
4. [stubbing sequential return values](docs/5-stubbing-results.md#stubbing-sequential-return-values)
89+
5. [argument matchers](docs/5-stubbing-results.md#loosening-stubbings-with-argument-matchers)
90+
1. [td.matchers.anything()](docs/5-stubbing-results.md#tdmatchersanything)
91+
2. [td.matchers.isA()](docs/5-stubbing-results.md#tdmatchersisa)
92+
3. [td.matchers.contains()](docs/5-stubbing-results.md#tdmatcherscontains)
93+
1. [matching strings](docs/5-stubbing-results.md#strings)
94+
2. [matching arrays](docs/5-stubbing-results.md#arrays)
95+
3. [matching objects](docs/5-stubbing-results.md#objects)
96+
4. [td.matchers.argThat()](docs/5-stubbing-results.md#tdmatchersargthat)
97+
5. [td.matchers.not()](docs/5-stubbing-results.md#tdmatchersnot)
98+
6. [Stubbing callback APIs](docs/5-stubbing-results.md#stubbing-callback-apis)
99+
7. [Stub exceptions with thenThrow](docs/5-stubbing-results.md#stub-exceptions-with-thenthrow)
100+
8. [Stub promises with thenResolve and thenReject](docs/5-stubbing-results.md#stub-promises-with-thenresolve-and-thenreject)
101+
9. [Stub side effects with thenDo](docs/5-stubbing-results.md#stub-side-effects-with-thendo)
102+
10. [Configuring stubbings](docs/5-stubbing-results.md#configuring-stubbings)
103+
1. [ignoreExtraArgs](docs/5-stubbing-results.md#ignoreextraargs)
104+
2. [times](docs/5-stubbing-results.md#times)
105+
3. [defer](docs/5-stubbing-results.md#defer)
106+
4. [delay](docs/5-stubbing-results.md#delay)
107107
6. [Verifying invocations](docs/6-verifying-invocations.md#verifying-interactions)
108-
1. [td.verify() API](docs/6-verifying-invocations.md#tdverify)
109-
2. [equality argument matching](docs/6-verifying-invocations.md#arguments)
110-
3. [argument matchers](docs/6-verifying-invocations.md#relaxing-verifications-with-argument-matchers)
111-
1. [td.matchers.anything()](docs/6-verifying-invocations.md#tdmatchersanything)
112-
2. [td.matchers.isA()](docs/6-verifying-invocations.md#tdmatchersisa)
113-
3. [td.matchers.contains()](docs/6-verifying-invocations.md#tdmatcherscontains)
114-
1. [matching strings](docs/6-verifying-invocations.md#strings)
115-
2. [matching arrays](docs/6-verifying-invocations.md#arrays)
116-
3. [matching objects](docs/6-verifying-invocations.md#objects)
117-
4. [td.matchers.argThat()](docs/6-verifying-invocations.md#tdmatchersargthat)
118-
4. [Argument captors](docs/6-verifying-invocations.md#multi-phase-assertions-with-argument-captors)
119-
5. [Configuring verifications](docs/6-verifying-invocations.md#configuring-verifications)
120-
1. [ignoreExtraArgs](docs/6-verifying-invocations.md#ignoreextraargs)
121-
2. [times](docs/6-verifying-invocations.md#times)
108+
1. [td.verify() API](docs/6-verifying-invocations.md#tdverify)
109+
2. [equality argument matching](docs/6-verifying-invocations.md#arguments)
110+
3. [argument matchers](docs/6-verifying-invocations.md#relaxing-verifications-with-argument-matchers)
111+
1. [td.matchers.anything()](docs/6-verifying-invocations.md#tdmatchersanything)
112+
2. [td.matchers.isA()](docs/6-verifying-invocations.md#tdmatchersisa)
113+
3. [td.matchers.contains()](docs/6-verifying-invocations.md#tdmatcherscontains)
114+
1. [matching strings](docs/6-verifying-invocations.md#strings)
115+
2. [matching arrays](docs/6-verifying-invocations.md#arrays)
116+
3. [matching objects](docs/6-verifying-invocations.md#objects)
117+
4. [td.matchers.argThat()](docs/6-verifying-invocations.md#tdmatchersargthat)
118+
4. [Argument captors](docs/6-verifying-invocations.md#multi-phase-assertions-with-argument-captors)
119+
5. [Configuring verifications](docs/6-verifying-invocations.md#configuring-verifications)
120+
1. [ignoreExtraArgs](docs/6-verifying-invocations.md#ignoreextraargs)
121+
2. [times](docs/6-verifying-invocations.md#times)
122122
7. [Replacing dependencies with test doubles](docs/7-replacing-dependencies.md#replacing-real-dependencies-with-test-doubles)
123-
1. [for Node.js](docs/7-replacing-dependencies.md#nodejs)
124-
2. [for Browser JS](docs/7-replacing-dependencies.md#browser)
125-
3. [td.replace() API](docs/7-replacing-dependencies.md#testdoublereplace-api)
123+
1. [for Node.js](docs/7-replacing-dependencies.md#nodejs)
124+
2. [for Browser JS](docs/7-replacing-dependencies.md#browser)
125+
3. [td.replace() API](docs/7-replacing-dependencies.md#testdoublereplace-api)
126126
8. [Writing custom argument matchers](docs/8-custom-matchers.md#custom-argument-matchers)
127127
9. [Debugging with testdouble.js](docs/9-debugging.md#debugging-with-testdoublejs)
128-
1. [td.explain() API](docs/9-debugging.md#tdexplainsometestdouble)
128+
1. [td.explain() API](docs/9-debugging.md#tdexplainsometestdouble)
129129
10. [Plugins](docs/A-plugins.md#plugins)
130-
1. [testdouble-chai](https://github.com/basecase/testdouble-chai)
131-
2. [testdouble-jasmine](https://github.com/BrianGenisio/testdouble-jasmine)
130+
1. [testdouble-chai](https://github.com/basecase/testdouble-chai)
131+
2. [testdouble-jasmine](https://github.com/BrianGenisio/testdouble-jasmine)
132132
11. [Frequently Asked Questions](docs/B-frequently-asked-questions.md#frequently-asked-questions)
133-
1. [Why doesn't `td.replace()` work with external CommonJS modules?](docs/B-frequently-asked-questions.md#why-doesnt-tdreplace-work-with-external-commonjs-modules)
134-
12. [Configuration](docs/C-configuration.md)
135-
1. [td.config](docs/C-configuration.md#tdconfig)
133+
1. [Why doesn't `td.replace()` work with external CommonJS modules?](docs/B-frequently-asked-questions.md#why-doesnt-tdreplace-work-with-external-commonjs-modules)
134+
12. [Configuration](docs/C-configuration.md#configuration)
135+
1. [td.config](docs/C-configuration.md#tdconfig)

docs/1-installation.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,6 @@ QUnit.testDone(function() {
100100
td.reset()
101101
})
102102
```
103+
104+
***
105+
Next: [Purpose](2-howto-purpose.md#purpose)

docs/2-howto-purpose.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,7 @@ in adapter functions to fake those adapters instead of the 3rd-party API—this
109109
will decrease the degree to which test doubles will leak throughout the
110110
integrated test suite and afford some opportunity for responding to hard-to-test
111111
situations by improving the API design of your adapters.
112+
113+
***
114+
Previous: [Installing testdouble.js](1-installation.md#installing-testdoublejs)
115+
Next: [Getting Started](3-getting-started.md#getting-started)

docs/3-getting-started.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,3 +354,7 @@ Further reading that documents the features shown off in this tutorial include:
354354
* [Creating test doubles with `function()` and `object()`](4-creating-test-doubles.md)
355355
* [Stubbing responses with `when()`](5-stubbing-results.md)
356356
* [Verifying invocations with `verify()`](6-verifying-invocations.md)
357+
358+
***
359+
Previous: [Purpose](2-howto-purpose.md#purpose)
360+
Next: [Creating Test Doubles](4-creating-test-doubles.md#creating-test-doubles)

docs/4-creating-test-doubles.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,3 +223,7 @@ FakeCat.prototype.scratch // a test double function named '#scratch'
223223
## Conclusion
224224

225225
As you can see, there are a plethora of ways to create test doubles with testdouble.js, each designed to handle a different style of organizing JavaScript code. We recommend on landing on one consistent style (e.g. each module as one function) for each project, which in turn would encourage one consistent style of creating test doubles. This API is written to be flexible for a number of potential contexts across objects, but it has come at the cost of a large enough surface area that if any project were to make ample use of all or most of the above invocation styles, it would confuse readers.
226+
227+
***
228+
Previous: [Getting Started](3-getting-started.md#getting-started)
229+
Next: [Stubbing behavior](5-stubbing-results.md#stubbing-behavior)

docs/5-stubbing-results.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,3 +622,7 @@ other major feature of any test double library—verifying an invocation took
622622
place—has an API that was carefully-designed to be completely symmetrical! Read
623623
on about [verifying interactions with `verify()`](6-verifying-invocations.md),
624624
and rest easy knowing that you already know exactly how to do it.
625+
626+
***
627+
Previous: [Creating Test Doubles](4-creating-test-doubles.md#creating-test-doubles#creating-test-doubles)
628+
Next: [Verifying interactions](6-verifying-invocations.md#verifying-interactions)

docs/6-verifying-invocations.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,3 +373,7 @@ td.verify(doNotCall(), {times: 0, ignoreExtraArgs: true}) // passes
373373
And that's everything there is to know about verifying behavior with
374374
testdouble.js! At this point, you know everything you need to know to be pretty
375375
dangerous writing isolated tests.
376+
377+
***
378+
Previous: [Stubbing behavior](5-stubbing-results.md#stubbing-behavior)
379+
Next: [Replacing Real Dependencies with Test Doubles](7-replacing-dependencies.md#replacing-real-dependencies-with-test-doubles)

docs/7-replacing-dependencies.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,4 +228,6 @@ path shouldn't exist yet, a second argument `manualReplacement` can be provided
228228
to short-circuit any attempts to load and imitate a module at
229229
`relativePathToModule`.
230230

231-
231+
***
232+
Previous: [Verifying interactions](6-verifying-invocations.md#verifying-interactions)
233+
Next: [Custom argument matchers](8-custom-matchers.md#custom-argument-matchers)

docs/8-custom-matchers.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
### Custom argument matchers
1+
# Custom argument matchers
22

33
In addition to the built-in argument matchers described along with
44
[stubbing](5-stubbing-results.md#loosening-stubbings-with-argument-matchers),
@@ -17,7 +17,7 @@ actual invocation if it passes lodash's deep
1717

1818
The examples in this document assume you've aliased `testdouble` to `td`.
1919

20-
#### Example
20+
## Example
2121

2222
Here's a naive implementation of a matcher named `isA` which will check whether
2323
the expected type of an argument matches the type of the argument actually passed
@@ -44,7 +44,7 @@ datePicker(new Date()) // 'good'
4444
datePicker(5) // undefined
4545
```
4646

47-
#### td.matchers.create API
47+
## td.matchers.create API
4848

4949
The `create` function takes a configuration object with the following properties
5050

@@ -64,3 +64,7 @@ opportunity to mutate the matcher instance or have some other side effect. The
6464

6565
For some examples of `td.matchers.create()` in action, check out the
6666
[built-in matchers](src/matchers/index.coffee) provided by testdouble.js.
67+
68+
***
69+
Previous: [Replacing Real Dependencies with Test Doubles](7-replacing-dependencies.md#replacing-real-dependencies-with-test-doubles)
70+
Next: [Debugging with testdouble.js](9-debugging.md#debugging-with-testdoublejs)

docs/9-debugging.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,6 @@ If you'd like to make `explain()` even better, consider sending a pull request
7979
to make [`explain` describe test double objects](https://github.com/testdouble/testdouble.js/issues/48)
8080
in addition to functions.
8181

82-
82+
***
83+
Previous: [Custom argument matchers](8-custom-matchers.md#custom-argument-matchers)
84+
Next: [Plugins](A-plugins.md#plugins)

0 commit comments

Comments
 (0)