-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.js
More file actions
67 lines (62 loc) · 2.38 KB
/
tests.js
File metadata and controls
67 lines (62 loc) · 2.38 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
// Unit tests for the helloWorld function
describe('helloWorld', function() {
it('should be a defined function', function() {
expect(typeof helloWorld).toBe('function');
});
it('should return a string when called', function() {
expect(typeof helloWorld()).toBe("string");
});
it('should return the string "Hello, World!" when executed', function() {
expect(helloWorld()).toBe("Hello, World!");
});
it("should never return 'undefined' when called", function() {
expect(helloWorld()).not.toBe(undefined);
});
});
// SayHello exercise 1
describe('sayHello', function() {
it('should be a defined function', function() {
expect(typeof sayHello).toBe('function');
});
it('should return a string when called', function() {
expect(typeof sayHello()).toBe("string");
});
it('should return the string "Hello, Jane!" when executed', function() {
expect(sayHello("Jane")).toBe("Hello, Jane!");
});
it('should return the string "Hello, Alex!" when executed', function() {
expect(sayHello("Alex")).toBe("Hello, Alex!");
});
it('should return the string "Hello, Pat!" when executed', function() {
expect(sayHello("Pat")).toBe("Hello, Pat!");
});
it('should return the string "Hello, World!" when executed', function() {
expect(sayHello("World")).toBe("Hello, World!");
});
it('should return the "Hello, World!" when passed true', function() {
expect(sayHello(true)).toBe("Hello, World!");
});
it('should return the "Hello, World!" when passed false', function() {
expect(sayHello(false)).toBe("Hello, World!");
});
it('should return the "Hello, World!" when passed 2.3', function() {
expect(sayHello(2.3)).toBe("Hello, World!");
});
});
describe('isFive', function() {
it('should be a defined function', function() {
expect(typeof isFive).toBe('function');
});
it('should return a boolean no matter what the input', function() {
expect(typeof isFive('boolean')).toBe('boolean');
});
it('should return true when passed 5', function() {
expect(isFive(5)).toBe(true);
});
it('should return true when passed "5"', function() {
expect(isFive("5")).toBe(true);
});
// it("should never return 'undefined' when called", function() {
// expect(helloWorld()).not.toBe(undefined);
// });
});