Skip to content

Commit d78ce9c

Browse files
1st save
1 parent d231f3a commit d78ce9c

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

unit-testing/exercises/RPS.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,18 @@ function whoWon(player1,player2){
1717
}
1818

1919
return 'Player 1 wins!';
20-
}
20+
}
21+
const test = require('../RPS.js');
22+
23+
module.exports = {
24+
whoWon: whoWon
25+
};
26+
test("returns 'Player 2 wins!' if P1 = rock & P2 = paper", function(){
27+
let output = test.whoWon('rock','paper');
28+
expect(output).toBe("Player 2 wins!");
29+
});
30+
31+
test("returns 'Player 2 wins!' if P1 = paper & P2 = scissors", function(){
32+
let output = test.whoWon('paper','scissors');
33+
expect(output).toBe("Player 2 wins!");
34+
});

0 commit comments

Comments
 (0)