-
Notifications
You must be signed in to change notification settings - Fork 200
Expand file tree
/
Copy pathutils.test.js
More file actions
65 lines (55 loc) · 1.56 KB
/
utils.test.js
File metadata and controls
65 lines (55 loc) · 1.56 KB
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
65
var assert = require("assert");
var utils = require("../lib/utils");
var mochaAsync = fn => {
return done => {
fn.call().then(done, err => {
done(err);
});
};
};
describe("Utils", function() {
describe("greetings", function() {
//it("Says Hello World", function () {
//assert.equal(utils.greetings("World"), "test");
//});
it("Says Hello World", function () {
assert.equal(utils.greetings("World"), "Hello World 👋👋");
});
it("Throws on missing params", function() {
assert.throws(() => {
utils.greetings();
}, Error);
});
it("Throws on empty string", function() {
assert.throws(() => {
utils.greetings("");
}, Error);
});
it("Does not throw on a valid string", function() {
assert.doesNotThrow(() => {
utils.greetings("Valid!");
}, Error);
});
});
describe("makeHeading", function() {
it("wraps the string in a H1", function() {
assert.equal(utils.makeHeading("Title"), "<h1>Title</h1>");
});
// it("trims any excess padding", function() {
// const out = utils.makeHeading(" Title with padding ");
// assert.equal(out, "<h1>Title with padding</h1>");
// });
// it("returns empty string on missing argument", function() {
// assert.equal(utils.makeHeading(), "");
// });
});
describe("fetchQuote", function() {
it(
"returns a nice msg",
mochaAsync(async () => {
const msg = await utils.fetchQuote();
assert.equal(msg, "Hey there bud");
})
);
});
});