Skip to content

Commit

Permalink
fix: tests + force release (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
smoya authored Oct 23, 2023
2 parents 2a2f76e + 629bdb1 commit f921df8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/recorder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ describe('Recorder', function() {
});

it('WithPeriodicFlushRecorder()', async function() {
jest.useFakeTimers(); // this mocks setTimeout global function
const sink = new testSink();
const recorderMetricsSpy = [];
const {recorder, stop} = WithPeriodicFlushRecorder(new Recorder('test', sink, recorderMetricsSpy), 100);
Expand All @@ -71,10 +72,9 @@ describe('Recorder', function() {
expect(recorderMetricsSpy).toHaveLength(1);
expect(recorderMetricsSpy[0]).toEqual(expectedMetric);

await new Promise(f => setTimeout(f, 700));
jest.advanceTimersByTime(200);
stop();

expect(sink.calledTimes).toBeGreaterThan(3); // Theory: 7 calls. Real: aprox 5 or 6 calls
expect(sink.calledTimes).toBeLessThan(8);
expect(sink.calledTimes).toEqual(3);
});
});

0 comments on commit f921df8

Please sign in to comment.