-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtests.js
46 lines (34 loc) · 1.05 KB
/
tests.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
const chai = require("chai");
const CNJokes = require("./index.js");
describe("get chucknorris joke", function() {
beforeEach(() => {
expect = chai.expect;
assert = chai.assert;
});
it("should return one random joke", function() {
CNJokes.getRandomJoke()
.then((response) => {
expect(response.data.type).to.equal("success");
});
});
it("should return count jokes", function() {
CNJokes.getNumberOfJokes()
.then((response) => {
assert.isNumber(response.data.value);
expect(response.data.type).to.equal("success");
});
});
it("should return random jokes", function() {
CNJokes.getRandomJokes()
.then((response) => {
expect(response.data.type).to.equal("success");
});
});
it("should return categories", function() {
CNJokes.getCategories()
.then((response) => {
assert.isArray(response.data.value);
expect(response.data.type).to.equal("success");
});
});
});