diff --git a/projects/ngx-lift/src/lib/utils/idle-detection/idle-detection.service.spec.ts b/projects/ngx-lift/src/lib/utils/idle-detection/idle-detection.service.spec.ts index 8c3b2a0..cecfe31 100644 --- a/projects/ngx-lift/src/lib/utils/idle-detection/idle-detection.service.spec.ts +++ b/projects/ngx-lift/src/lib/utils/idle-detection/idle-detection.service.spec.ts @@ -30,22 +30,24 @@ describe('IdleDetectionService', () => { expect(service['isCountingDown']).toBeFalse(); }); - it('should start countdown after idle end', () => { + it('should start countdown after idle end', (done) => { service.startWatching(); setTimeout( () => { expect(service['isCountingDown']).toBeTrue(); + done(); }, service['idleDuration'] * 1000 + 100, ); }); - it('should stop countdown on user activity during countdown', () => { + it('should stop countdown on user activity during countdown', (done) => { service.startWatching(); setTimeout(() => { const event = new MouseEvent('mousemove'); document.dispatchEvent(event); expect(service['isCountingDown']).toBeFalse(); + done(); }, 3000); });