Skip to content

Commit 4580d71

Browse files
committed
tests: add tests reproducing testing-library#914
1 parent aa1309c commit 4580d71

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/__tests__/helpers.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,16 @@ describe('run with real timers', () => {
9797
})
9898
expect(global.setTimeout).toBe(fakedSetTimeout)
9999
})
100+
101+
test('safe check for setImmediate and clearImmediate', () => {
102+
const setImeediate = global.setImmediate
103+
const clearImmediate = global.clearImmediate
104+
delete global.setImmediate
105+
delete global.clearImmediate
106+
107+
expect(() => runWithRealTimers(() => {})).not.toThrow()
108+
109+
global.setImmediate = setImeediate
110+
global.clearImmediate = clearImmediate
111+
})
100112
})

0 commit comments

Comments
 (0)