Skip to content

Commit 6f41113

Browse files
committed
docs: add cache reset details to testing.mdx
1 parent 0a1ed18 commit 6f41113

File tree

3 files changed

+32
-5
lines changed

3 files changed

+32
-5
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,6 @@ If you can't access Slack, you can also [subscribe to our mailing list](mailto:g
116116

117117
Otherwise, if you have a deeper query or require more support, please [raise an issue](https://github.com/finos/git-proxy/issues) 🧵
118118

119-
🤝 Join our [fortnightly Zoom meeting](https://zoom-lfx.platform.linuxfoundation.org/meeting/95849833904?password=99413314-d03a-4b1c-b682-1ede2c399595) on Monday, 4PM BST (odd week numbers).
120-
🌍 [Convert to your local time](https://www.timeanddate.com/worldclock)
119+
🤝 Join our [fortnightly Zoom meeting](https://zoom-lfx.platform.linuxfoundation.org/meeting/95849833904?password=99413314-d03a-4b1c-b682-1ede2c399595) on Monday, 4PM BST (odd week numbers).
120+
🌍 [Convert to your local time](https://www.timeanddate.com/worldclock)
121121
📅 [Click here](https://calendar.google.com/calendar/event?action=TEMPLATE&tmeid=MTRvbzM0NG01dWNvNGc4OGJjNWphM2ZtaTZfMjAyNTA2MDJUMTUwMDAwWiBzYW0uaG9sbWVzQGNvbnRyb2wtcGxhbmUuaW8&tmsrc=sam.holmes%40control-plane.io&scp=ALL) for the recurring Google Calendar meeting invite. Alternatively, send an e-mail to [help@finos.org](https://zoom-lfx.platform.linuxfoundation.org/meeting/95849833904?password=99413314-d03a-4b1c-b682-1ede2c399595#:~:text=Need-,an,-invite%3F) to get a calendar invitation.

website/docs/development/contributing.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ When updating the configuration schema, you must also re-generate the reference
4848
<!-- Notes around signing the CLA. See existing CONTRIBUTING.md -->
4949

5050
## Community Meetings
51-
Join our [fortnightly Zoom meeting](https://zoom-lfx.platform.linuxfoundation.org/meeting/95849833904?password=99413314-d03a-4b1c-b682-1ede2c399595) on Monday, 4PM BST (odd week numbers).
52-
🌍 [Convert to your local time](https://www.timeanddate.com/worldclock)
51+
Join our [fortnightly Zoom meeting](https://zoom-lfx.platform.linuxfoundation.org/meeting/95849833904?password=99413314-d03a-4b1c-b682-1ede2c399595) on Monday, 4PM BST (odd week numbers).
52+
🌍 [Convert to your local time](https://www.timeanddate.com/worldclock)
5353
[Click here](https://calendar.google.com/calendar/event?action=TEMPLATE&tmeid=MTRvbzM0NG01dWNvNGc4OGJjNWphM2ZtaTZfMjAyNTA2MDJUMTUwMDAwWiBzYW0uaG9sbWVzQGNvbnRyb2wtcGxhbmUuaW8&tmsrc=sam.holmes%40control-plane.io&scp=ALL) for the recurring Google Calendar meeting invite.
5454
Alternatively, send an e-mail to [help@finos.org](https://zoom-lfx.platform.linuxfoundation.org/meeting/95849833904?password=99413314-d03a-4b1c-b682-1ede2c399595#:~:text=Need-,an,-invite%3F) to get a calendar invitation.
5555

website/docs/development/testing.mdx

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,33 @@ after(async function () {
150150
await db.deleteUser('u1');
151151
await db.deleteUser('u2');
152152
});
153+
154+
afterEach(() => {
155+
sinon.restore();
156+
});
157+
```
158+
159+
Note that `after` will execute once after **all** the tests are complete, whereas `afterEach` will execute at the end of **each** test.
160+
161+
#### Reset sinon and proxyquire cache
162+
163+
**It's very important to reset Sinon and the Proxyquire/require cache after each test** when necessary. This prevents old stubs from leaking into subsequent tests.
164+
165+
Here is an example of a function that resets both of these after each test (`test/chain.test.js`):
166+
167+
```js
168+
const clearCache = (sandbox) => {
169+
delete require.cache[require.resolve('../src/proxy/processors')];
170+
delete require.cache[require.resolve('../src/proxy/chain')];
171+
sandbox.reset();
172+
};
173+
174+
...
175+
176+
afterEach(() => {
177+
// Clear the module from the cache after each test
178+
clearCache(sandboxSinon);
179+
});
153180
```
154181

155182
#### Focus on expected behaviour
@@ -185,7 +212,7 @@ expect(authMethods[0].type).to.equal('local');
185212

186213
If test coverage is still insufficient after writing your tests, check out the [CodeCov report](https://app.codecov.io/gh/finos/git-proxy) after making the PR and take a look at which lines are missing coverage.
187214

188-
### E2E testing with Cypress
215+
### UI testing with Cypress
189216

190217
Although coverage is currently low, we have introduced Cypress testing to make sure that end-to-end flows are working as expected with every added feature.
191218

0 commit comments

Comments
 (0)