Skip to content

Commit 2083883

Browse files
committed
Increase timestamp comparison tolerance
1 parent 7fd512a commit 2083883

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

packages/core/test/tracing/integrations/appStart.test.ts

+18
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,24 @@ jest.mock('@sentry/utils', () => {
6363
};
6464
});
6565

66+
// Overrides expect.closeTo to increase tolerance from 0.005 (2 decimal digits) to 0.025
67+
expect.extend({
68+
closeTo(received, expected, tolerance = 0.025) {
69+
const pass = Math.abs(expected - received) < tolerance;
70+
if (pass) {
71+
return {
72+
message: () => `expected ${received} not to be close to ${expected} within ${tolerance}`,
73+
pass: true,
74+
};
75+
} else {
76+
return {
77+
message: () => `expected ${received} to be close to ${expected} within ${tolerance}`,
78+
pass: false,
79+
};
80+
}
81+
},
82+
});
83+
6684
describe('App Start Integration', () => {
6785
beforeEach(() => {
6886
mockReactNativeBundleExecutionStartTimestamp();

0 commit comments

Comments
 (0)