-
Notifications
You must be signed in to change notification settings - Fork 1
/
demo.js
38 lines (32 loc) · 966 Bytes
/
demo.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
require("./").install();
// This bit is just to easily update the README
describe("issue #101 ES5 version", function() {
it("shows a normal sync test", function() {
// passes
});
it("will fail", function() {
throw new Error("My error");
});
it("shows a normal async test using callbacks", function(done) {
setTimeout(() => {
done();
});
});
it("will fail async", function(done) {
setTimeout(() => {
done(new Error("My error"));
});
});
});
describe("async/await (aka Promises) feature", function() {
it("should passe as expected", async function() {
await new Promise(function(resolve, reject) {
setTimeout(resolve, 500);
});
});
it("should fail", async function() {
await new Promise(function(resolve, reject) {
setTimeout(reject, 500, new TypeError("Some wrong type"));
});
});
});