Skip to content

Commit

Permalink
fix: fix UT
Browse files Browse the repository at this point in the history
  • Loading branch information
GUANGHUIW\74777 authored and wghglory committed Dec 23, 2024
1 parent 580bfc0 commit b9b904a
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Expand Down

0 comments on commit b9b904a

Please sign in to comment.