@@ -4,5 +4,62 @@ const launchcode = require('../index.js');
4
4
describe ( "Testing launchcode" , function ( ) {
5
5
6
6
// Write your unit tests here!
7
+ it ( 'should have organization as "nonprofit"' , function ( ) {
8
+ expect ( launchcode . organization ) . toBe ( 'nonprofit' ) ;
9
+ } ) ;
7
10
11
+ it ( 'should have executiveDirector as "Jeff"' , function ( ) {
12
+ expect ( launchcode . executiveDirector ) . toBe ( 'Jeff' ) ;
13
+ } ) ;
14
+ it ( 'should have percentageCoolEmployees as 100' , function ( ) {
15
+ expect ( launchcode . percentageCoolEmployees ) . toBe ( 100 ) ;
16
+ } ) ;
17
+ it ( 'should have programsOffered containing "Web Development", "Data Analysis", and "Liftoff"' , function ( ) {
18
+ expect ( launchcode . programsOffered ) . toContain ( 'Web Development' ) ;
19
+ expect ( launchcode . programsOffered ) . toContain ( 'Data Analysis' ) ;
20
+ expect ( launchcode . programsOffered ) . toContain ( 'Liftoff' ) ;
21
+ expect ( launchcode . programsOffered ) . toHaveLength ( 3 ) ;
22
+ } ) ;
23
+ } ) ;
24
+ describe ( "Testing launchOutput method" , function ( ) {
25
+
26
+ // Test for number divisible only by 2
27
+ it ( 'should return "Launch!" for numbers divisible only by 2' , function ( ) {
28
+ expect ( launchcode . launchOutput ( 4 ) ) . toBe ( 'Launch!' ) ;
29
+ } ) ;
30
+
31
+ // Test for number divisible only by 3
32
+ it ( 'should return "Code!" for numbers divisible only by 3' , function ( ) {
33
+ expect ( launchcode . launchOutput ( 9 ) ) . toBe ( 'Code!' ) ;
34
+ } ) ;
35
+
36
+ // Test for number divisible only by 5
37
+ it ( 'should return "Rocks!" for numbers divisible only by 5' , function ( ) {
38
+ expect ( launchcode . launchOutput ( 25 ) ) . toBe ( 'Rocks!' ) ;
39
+ } ) ;
40
+
41
+ // Test for number divisible by 2 and 3
42
+ it ( 'should return "LaunchCode!" for numbers divisible by 2 and 3' , function ( ) {
43
+ expect ( launchcode . launchOutput ( 6 ) ) . toBe ( 'LaunchCode!' ) ;
44
+ } ) ;
45
+
46
+ // Test for number divisible by 3 and 5
47
+ it ( 'should return "Code Rocks!" for numbers divisible by 3 and 5' , function ( ) {
48
+ expect ( launchcode . launchOutput ( 15 ) ) . toBe ( 'Code Rocks!' ) ;
49
+ } ) ;
50
+
51
+ // Test for number divisible by 2 and 5
52
+ it ( 'should return "Launch Rocks! (CRASH!!!!)" for numbers divisible by 2 and 5' , function ( ) {
53
+ expect ( launchcode . launchOutput ( 10 ) ) . toBe ( 'Launch Rocks! (CRASH!!!!)' ) ;
54
+ } ) ;
55
+
56
+ // Test for number divisible by 2, 3, and 5
57
+ it ( 'should return "LaunchCode Rocks!" for numbers divisible by 2, 3, and 5' , function ( ) {
58
+ expect ( launchcode . launchOutput ( 30 ) ) . toBe ( 'LaunchCode Rocks!' ) ;
59
+ } ) ;
60
+
61
+ // Test for number not divisible by 2, 3, or 5
62
+ it ( 'should return "Rutabagas! That doesn\'t work." for numbers not divisible by 2, 3, or 5' , function ( ) {
63
+ expect ( launchcode . launchOutput ( 7 ) ) . toBe ( "Rutabagas! That doesn't work." ) ;
64
+ } ) ;
8
65
} ) ;
0 commit comments