Skip to content

Commit 9976fab

Browse files
committed
repro probable bug?
1 parent 51653cb commit 9976fab

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

packages/core/src/analytics/__tests__/dispatch.test.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,30 +99,28 @@ describe('Dispatch', () => {
9999
expect.anything()
100100
)
101101
})
102-
// TODO: Weird and inconsistent behavior
103-
it('should have bizarre and inconsistent timeout behavior where the delay is different based on whether timeout is explicitly set to 1000 or not', async () => {
102+
// TODO: Inconsistent behavior? This seems like a bug.
103+
it('should have inconsistent timeout behavior where the delay is different based on whether timeout is explicitly set to 1000 or not', async () => {
104104
{
105105
const TIMEOUT = 1000
106106
await dispatch({ type: 'screen' }, queue, emitter, {
107107
callback: jest.fn(),
108108
timeout: TIMEOUT,
109109
})
110110
const [, , delay] = invokeCallback.mock.calls[0]
111-
// timeout = 1000, delay equals 998
112-
expect(delay).toBeGreaterThan(990)
113-
expect(delay).toBeLessThanOrEqual(1000)
111+
expect(delay).toBeGreaterThan(990) // ???
112+
expect(delay).toBeLessThanOrEqual(1000) // ???
114113
}
115114
{
116-
// wtf
117115
invokeCallback.mockReset()
118116
const TIMEOUT = undefined // this defaults to 1000 in the invokeCallback function
119117
await dispatch({ type: 'screen' }, queue, emitter, {
120118
callback: jest.fn(),
121119
timeout: TIMEOUT,
122120
})
123121
const [, , delay] = invokeCallback.mock.calls[0]
124-
expect(delay).toBeGreaterThan(290)
125-
expect(delay).toBeLessThanOrEqual(300)
122+
expect(delay).toBeGreaterThan(290) // ???
123+
expect(delay).toBeLessThanOrEqual(300) // ???
126124
}
127125
})
128126
})

0 commit comments

Comments
 (0)