Skip to content
This repository was archived by the owner on Oct 16, 2024. It is now read-only.

Commit 76f9eca

Browse files
committed
fixed #60
1 parent 35e09b5 commit 76f9eca

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

packages/core/tests/unit/event/event.job.test.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,26 @@ describe('EventJob Tests', () => {
55
const eventJob = new EventJob('myPayload');
66

77
expect(eventJob.payload).toBe('myPayload');
8-
expect(eventJob.creationTimestamp).toBeCloseTo(new Date().getTime(), -1);
8+
expect(eventJob.creationTimestamp).toBeCloseTo(
9+
new Date().getTime(),
10+
calculatePrecision(100)
11+
);
912
expect(eventJob.keys).toBeUndefined();
1013
});
1114

1215
it('should create EventJob (with keys)', () => {
1316
const eventJob = new EventJob('myPayload', ['dummyKey1', 'dummyKey2']);
1417

1518
expect(eventJob.payload).toBe('myPayload');
16-
expect(eventJob.creationTimestamp).toBeCloseTo(new Date().getTime(), -1);
19+
expect(eventJob.creationTimestamp).toBeCloseTo(
20+
new Date().getTime(),
21+
calculatePrecision(100)
22+
);
1723
expect(eventJob.keys).toStrictEqual(['dummyKey1', 'dummyKey2']);
1824
});
1925
});
26+
27+
// https://github.com/facebook/jest/issues/5218
28+
function calculatePrecision(deviation) {
29+
return -Math.log10(2 * deviation);
30+
}

0 commit comments

Comments
 (0)