Skip to content

Commit 73afce7

Browse files
chore: bump sinon from 18.0.1 to 21.0.0 (#10189)
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Diana Barsan <barsan@medic.org>
1 parent 8207e44 commit 73afce7

File tree

12 files changed

+77
-54
lines changed

12 files changed

+77
-54
lines changed

config/default/test/targets/births.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ describe('Births this month target tests', () => {
2626

2727
it('birth this month should be counted', async () => {
2828
//await harness.setNow('2000-04-30');//DOB: 2000-04-24
29-
clock = sinon.useFakeTimers({now: moment('2000-04-30').toDate()});
29+
clock = sinon.useFakeTimers({ now: moment('2000-04-30').toDate(), toFake: ['Date'] });
3030
const birthsThisMonth = await harness.getTargets({ type: 'births-this-month' });
3131
expect(birthsThisMonth).to.have.property('length', 1);
3232
expect(birthsThisMonth[0]).to.nested.include({ 'value.pass': 1, 'value.total': 1 });
3333
});
3434

3535
it('birth last month should not be counted', async () => {
3636
//await harness.setNow('2000-04-30');//DOB: 2000-04-24
37-
clock = sinon.useFakeTimers({now: moment('2000-05-01').toDate()});
37+
clock = sinon.useFakeTimers({ now: moment('2000-05-01').toDate(), toFake: ['Date'] });
3838
const birthsThisMonth = await harness.getTargets({ type: 'births-this-month' });
3939
expect(birthsThisMonth).to.have.property('length', 1);
4040
expect(birthsThisMonth[0]).to.nested.not.include({ 'value.pass': 1, 'value.total': 1 });

config/default/test/targets/deaths.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('Death related targets tests', () => {
2525

2626
it('death this month target test this month', async () => {
2727
//await harness.setNow('2000-04-30');//DOD: 2000-04-25
28-
clock = sinon.useFakeTimers({now: moment('2000-04-30').toDate()});
28+
clock = sinon.useFakeTimers({ now: moment('2000-04-30').toDate(), toFake: ['Date'] });
2929
harness.subject = babyDeceasedAtAge1Day;
3030
const birthsThisMonth = await harness.getTargets({ type: 'deaths-this-month' });
3131
expect(birthsThisMonth).to.have.property('length', 1);
@@ -34,7 +34,7 @@ describe('Death related targets tests', () => {
3434

3535
it('death this month target test next month', async () => {
3636
//await harness.setNow('2000-04-30');//DOD: 2000-04-25
37-
clock = sinon.useFakeTimers({now: moment('2000-05-30').toDate()});
37+
clock = sinon.useFakeTimers({ now: moment('2000-05-30').toDate(), toFake: ['Date'] });
3838
harness.subject = babyDeceasedAtAge1Day;
3939
const birthsThisMonth = await harness.getTargets({ type: 'deaths-this-month' });
4040
expect(birthsThisMonth).to.have.property('length', 1);

package-lock.json

Lines changed: 52 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@
173173
"sass": "^1.83.4",
174174
"sharp": "^0.33.5",
175175
"shellcheck": "^3.1.0",
176-
"sinon": "^18.0.1",
176+
"sinon": "^21.0.0",
177177
"tail": "^2.2.6",
178178
"ts-node": "^10.9.2",
179179
"typedoc": "^0.28.7",
@@ -182,6 +182,7 @@
182182
"util": "^0.12.5",
183183
"wdio-chromedriver-service": "^8.1.1",
184184
"webpack-bundle-analyzer": "^4.9.1",
185+
"xhr-mock": "^2.5.1",
185186
"xml-js": "^1.6.11"
186187
},
187188
"dependencies": {

shared-libs/rules-engine/test/integration.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ describe(`Rules Engine Integration Tests`, () => {
104104
let configHashSalt = 0;
105105

106106
beforeEach(() => {
107-
clock = sinon.useFakeTimers({now: TEST_START});
107+
clock = sinon.useFakeTimers({ now: TEST_START, toFake: ['Date'] });
108108
});
109109

110110
afterEach(() => {

shared-libs/rules-engine/test/pouchdb-provider.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ describe('pouchdb provider', () => {
151151
db = await memdownMedic('../..');
152152
await db.bulkDocs(fixtures);
153153

154-
clock = sinon.useFakeTimers({now: 100000000});
154+
clock = sinon.useFakeTimers({ now: 100000000, toFake: ['Date'] });
155155
sinon.spy(db, 'put');
156156
sinon.spy(db, 'query');
157157
});

shared-libs/rules-engine/test/provider-wireup.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ describe('provider-wireup integration tests', () => {
8181
let provider;
8282
let db;
8383
beforeEach(async () => {
84-
clock = sinon.useFakeTimers({now: NOW});
84+
clock = sinon.useFakeTimers({ now: NOW, toFake: ['setTimeout', 'Date'] });
8585
wireup = rewire('../src/provider-wireup');
8686
rulesStateStore = RestorableRulesStateStore();
8787
sinon.stub(rulesStateStore, 'currentUserContact').returns(currentUserContact);

shared-libs/rules-engine/test/refresh-rules-emissions.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const NOW = 100000;
1111

1212
describe('refresh-rules-emissions', () => {
1313
beforeEach(() => {
14-
clock = sinon.useFakeTimers(NOW);
14+
clock = sinon.useFakeTimers({ now: NOW, toFake: ['Date'] });
1515
refreshRulesEmissionsContact = rewire('../src/refresh-rules-emissions');
1616
});
1717

shared-libs/rules-engine/test/rules-emitter.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ for (const rulesAreDeclarative of declarativeScenarios) {
218218

219219
it('trigger task.anc.pregnancy_home_visit', async () => {
220220
const time = moment('2000-01-01');
221-
clock = sinon.useFakeTimers({now: time.valueOf()});
221+
clock = sinon.useFakeTimers({ now: time.valueOf(), toFake: ['Date'] });
222222

223223
const initialized = rulesEmitter.initialize(engineSettings({ rulesAreDeclarative }));
224224
expect(initialized).to.be.true;

shared-libs/rules-engine/test/task-states.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ let clock;
1212

1313
describe('task-states', () => {
1414
before(() => {
15-
clock = sinon.useFakeTimers({now: NOW});
15+
clock = sinon.useFakeTimers({ now: NOW, toFake: ['Date'] });
1616
TaskStates = rewire('../src/task-states');
1717
definedStates = Object.keys(TaskStates).filter(key => typeof TaskStates[key] === 'string');
1818
});

0 commit comments

Comments
 (0)