Skip to content

Commit 0d4dc4c

Browse files
committed
Unit testing exercises
1 parent 6705419 commit 0d4dc4c

File tree

6 files changed

+3564
-7
lines changed

6 files changed

+3564
-7
lines changed

unit-testing/exercises/RPS.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,16 @@ function whoWon(player1,player2){
1212
return 'Player 2 wins!';
1313
}
1414

15-
if (player1 === 'scissors' && player2 === 'rock '){
15+
if (player1 === 'scissors' && player2 === 'rock'){
1616
return 'Player 2 wins!';
1717
}
18+
if (player1 !== 'scissors' || player2 !== 'scissors' ||
19+
player1 !== 'paper' || player2 !== 'paper' ||
20+
player1 !== 'rock' || player2 !== 'rock'){
21+
return 'Invalid Input';
22+
}
1823

1924
return 'Player 1 wins!';
20-
}
25+
}
26+
27+
module.exports = whoWon;

unit-testing/exercises/checkFive.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ function checkFive(num){
88
result = num + " is greater than 5.";
99
}
1010
return result;
11-
}
11+
}
12+
13+
module.exports = checkFive;

0 commit comments

Comments
 (0)