-
Notifications
You must be signed in to change notification settings - Fork 1
/
test1.test.js
64 lines (57 loc) · 1.2 KB
/
test1.test.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
const fs = require("fs");
let {
bacaData,
modifyFile1,
modifyFile2,
modifyFile3,
} = require("./fungsiCustom");
describe("Test app using real data", () => {
it("bacaData should be a function", async () => {
expect(bacaData).toBeInstanceOf(Function);
});
it("bacaData should not be null", (done) => {
bacaData((err, data) => {
if (err) {
done(err);
return;
}
try {
expect(err).toBe(null);
done();
} catch (err) {
done(err);
}
});
});
it("bacaData should have data with length equals 3", (done) => {
bacaData((err, data) => {
if (err) {
done(err);
return;
}
try {
expect(data.length).toBe(3);
done();
} catch (err) {
done(err);
}
});
});
it("bacaData should have data with value as intended", (done) => {
bacaData((err, data) => {
if (err) {
done(err);
return;
}
try {
console.log(data);
expect(data).toContain("dunia");
expect(data).toContain("world");
expect(data).toContain("sekai");
done();
} catch (err) {
done(err);
}
});
});
});