MCPcopy Index your code
hub / github.com/github/relative-time-element / freezeTime

Function freezeTime

test/relative-time.js:7–24  ·  view source on GitHub ↗
(expected)

Source from the content-addressed store, hash-verified

5 let dateNow
6
7 function freezeTime(expected) {
8 dateNow = Date
9
10 function MockDate(...args) {
11 if (args.length) {
12 return new dateNow(...args)
13 }
14 return new dateNow(expected)
15 }
16
17 MockDate.UTC = dateNow.UTC
18 MockDate.parse = dateNow.parse
19 MockDate.now = () => expected.getTime()
20 MockDate.prototype = dateNow.prototype
21
22 // eslint-disable-next-line no-global-assign
23 Date = MockDate
24 }
25
26 let fixture
27 suiteSetup(() => {

Callers 1

relative-time.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…