Skip to content

Commit d458034

Browse files
committed
test cleanup
1 parent b86f93b commit d458034

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/browser/src/plugins/segmentio/__tests__/retries.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ describe('retryQueue', () => {
140140
let analytics: Analytics
141141
let segment: Plugin
142142
beforeEach(async () => {
143-
jest.useRealTimers()
143+
jest.useFakeTimers({ advanceTimers: true })
144144
jest.resetAllMocks()
145145
jest.restoreAllMocks()
146146

@@ -150,9 +150,11 @@ describe('retryQueue', () => {
150150

151151
fetch.mockReturnValue(createError({ status: 500 }))
152152
})
153+
afterEach(() => {
154+
jest.useRealTimers()
155+
})
153156

154157
it('Only attempts once if retryQueue is false', async () => {
155-
jest.useFakeTimers({ advanceTimers: true })
156158
analytics = new Analytics(
157159
{ writeKey: options.apiKey },
158160
{ retryQueue: false }
@@ -170,7 +172,6 @@ describe('retryQueue', () => {
170172
})
171173

172174
it('Attempts multiple times if retryQueue is true', async () => {
173-
jest.useFakeTimers({ advanceTimers: true })
174175
analytics = new Analytics(
175176
{ writeKey: options.apiKey },
176177
{ retryQueue: true }

0 commit comments

Comments
 (0)