it('should get Date diff correctly in fakeAsync with rxjs scheduler', fakeAsync(() => { // need to add `import 'zone.js/dist/zone-patch-rxjs-fake-async' // to patch rxjs scheduler let result = null; of ('hello').pipe(delay(1000)).subscribe(v => { result = v; }); expect(result).toBeNull(); tick(1000); expect(result).toBe('hello'); const start = new Date().getTime(); let dateDiff = 0; interval(1000).pipe(take(2)).subscribe(() => dateDiff = (new Date().getTime() - start)); tick(1000); expect(dateDiff).toBe(1000); tick(1000); expect(dateDiff).toBe(2000); }));