Skip to content

Commit 23b2360

Browse files
improve test
1 parent 9bf4e91 commit 23b2360

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/index.test.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,21 @@ describe('SilentHack', () => {
1212
expect(silentHack).toBeInstanceOf(SilentHack);
1313
});
1414

15-
it('should have a state of blocked', () => {
16-
expect(silentHack.state).toBe('blocked');
15+
it('should be not allowed', () => {
16+
expect(silentHack.allowed).toBe(false);
1717
});
1818

1919
it('should have a trying property of false', () => {
2020
expect(silentHack.trying).toBe(false);
2121
});
22+
23+
it('should call tryUnblock on event', async () => {
24+
const event = new Event('click');
25+
window.dispatchEvent(event);
26+
expect(silentHack.trying).toBe(true);
27+
28+
await new Promise((resolve) => setTimeout(resolve, 100));
29+
30+
expect(silentHack.allowed).toBe(true);
31+
});
2232
});

0 commit comments

Comments
 (0)