Skip to content

Commit bbec452

Browse files
author
Your Name
committed
Angular Testing Course
1 parent 5ff5a55 commit bbec452

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

src/app/courses/home/async-examples.spec.ts

+41-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {fakeAsync, flush, tick} from '@angular/core/testing';
12

23

34
fdescribe("Async Testing Examples", () => {
@@ -19,7 +20,46 @@ fdescribe("Async Testing Examples", () => {
1920

2021
}, 1000);
2122

23+
24+
2225
});
2326

2427

25-
});
28+
it("Asynchronous test example - setTimeout()", fakeAsync(() => {
29+
30+
let test = false;
31+
32+
setTimeout(() => {});
33+
34+
setTimeout(() => {
35+
36+
console.log('running assertions setTimeout()');
37+
38+
test = true;
39+
40+
}, 1000);
41+
42+
flush();
43+
44+
expect(test).toBeTruthy();
45+
46+
}));
47+
48+
49+
});
50+
51+
52+
53+
54+
55+
56+
57+
58+
59+
60+
61+
62+
63+
64+
65+

0 commit comments

Comments
 (0)