-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathjasmine_timers.javascript.txt
28 lines (19 loc) · 1.33 KB
/
jasmine_timers.javascript.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
┏━━━━━━━━━━━━━━━━━━━━┓
┃ JASMINE_TIMERS ┃
┗━━━━━━━━━━━━━━━━━━━━┛
ALTERNATIVES ==> #See @sinonjs/fake-timers
VERSION ==> #Part of Jasmine (see its doc)
#Mocks setTimeout|Interval()
┌──────────┐
│ CORE │
└──────────┘
JASMINE.clock()->CLOCK #Always returns same singleton
CLOCK.install() #Mock setTimeout|Interval()
CLOCK.uninstall() #
CLOCK.withMock(FUNC) #Calls CLOCK.install|uninstall() before FUNC and after it (in a "finally")
CLOCK.mockDate([DATE]) #Make new Date() follow CLOCK instead of time
#DATE is time when CLOCK is starting (def: now).
┌─────────────┐
│ ADVANCE │
└─────────────┘
CLOCK.tick(NUM) #Advance time (in ms)