Skip to content

Commit 3b72a4e

Browse files
committed
unit testing studio
1 parent 460836d commit 3b72a4e

File tree

1 file changed

+54
-2
lines changed

1 file changed

+54
-2
lines changed
Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,60 @@
11
// launchcode.test.js code:
22
const launchcode = require('../index.js');
33

4-
describe("Testing launchcode", function(){
4+
describe("Testing launchcode object", function() {
55

66
// Write your unit tests here!
7+
test("should have a property called organization", function() {
8+
expect(launchcode.organization).toEqual("nonprofit");
9+
});
10+
11+
test("should have a property called executiveDirector", function() {
12+
expect(launchcode.executiveDirector).toEqual("Jeff");
13+
});
14+
15+
test("should have a property called percentageCoolEmployees", function() {
16+
expect(launchcode.percentageCoolEmployees).toEqual(100);
17+
});
18+
19+
test("should have a property called programsOffered", function() {
20+
expect(launchcode.programsOffered[0]).toEqual("Web Development");
21+
expect(launchcode.programsOffered[1]).toEqual("Data Analysis");
22+
expect(launchcode.programsOffered[2]).toEqual("Liftoff");
23+
expect(launchcode.programsOffered.length).toEqual(3);
24+
});
25+
26+
test("should return 'Launch!' for number evenly divisible by 2", function() {
27+
expect(launchcode.launchOutput(2)).toEqual("Launch!")
28+
});
29+
30+
test("should return 'Code!' for number evenly divisible by 3", function() {
31+
expect(launchcode.launchOutput(3)).toEqual("Code!")
32+
});
33+
34+
test("should return 'Rocks!' for number evenly divisible by 5", function() {
35+
expect(launchcode.launchOutput(5)).toEqual("Rocks!")
36+
});
37+
38+
test("should return 'LaunchCode!' for number evenly divisible by both 2 and 3", function() {
39+
expect(launchcode.launchOutput(6)).toEqual("LaunchCode!")
40+
});
741

8-
});
42+
test("should return 'Code Rocks!' for number evenly divisible by both 3 and 5", function() {
43+
expect(launchcode.launchOutput(15)).toEqual("Code Rocks!")
44+
});
45+
46+
test("should return 'Launch Rocks!' for number evenly divisible by both 2 and 5", function() {
47+
expect(launchcode.launchOutput(10)).toEqual("Launch Rocks!")
48+
});
49+
50+
test("should return 'LaunchCode Rocks!' for number evenly divisible by 2, 3 and 5", function() {
51+
expect(launchcode.launchOutput(30)).toEqual("LaunchCode Rocks!")
52+
});
53+
54+
test("should return 'Rutabagas! That does not work.' for numbers NOT evenly divisible by 2, 3 or 5", function() {
55+
expect(launchcode.launchOutput(7)).toEqual("Rutabagas! That does not work.")
56+
});
57+
58+
59+
})
60+

0 commit comments

Comments
 (0)