File tree 2 files changed +25
-1
lines changed
2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -17,4 +17,8 @@ function whoWon(player1,player2){
17
17
}
18
18
19
19
return 'Player 1 wins!' ;
20
- }
20
+ }
21
+
22
+ module . exports = {
23
+ whoWon : whoWon
24
+ } ;
Original file line number Diff line number Diff line change
1
+ const findWinner = require ( '../RPS.js' ) ;
2
+
3
+ describe ( "Who Won Test" , function ( ) {
4
+
5
+ test ( "returns 'Player 2 wins!' if P1 = rock & P2 = paper" , function ( ) {
6
+ let output = findWinner . whoWon ( 'rock' , 'paper' ) ;
7
+ expect ( output ) . toBe ( "Player 2 wins!" ) ;
8
+ } ) ;
9
+
10
+ test ( "returns 'Player 2 wins!' if P1 = paper & P2 = scissors" , function ( ) {
11
+ let output = findWinner . whoWon ( 'paper' , 'scissors' ) ;
12
+ expect ( output ) . toBe ( "Player 2 wins!" ) ;
13
+ } ) ;
14
+
15
+ test ( "returns 'Player 2 wins!' if P1 = scissors & P2 = rock" , function ( ) {
16
+ let output = findWinner . whoWon ( 'scissors' , 'rock' ) ;
17
+ expect ( output ) . toBe ( "Player 2 wins!" ) ;
18
+ } ) ;
19
+
20
+ } ) ;
You can’t perform that action at this time.
0 commit comments