Skip to content

Commit 61d49bb

Browse files
Quinton KornegayQuinton Kornegay
Quinton Kornegay
authored and
Quinton Kornegay
committed
rps kinda
1 parent 5bbd449 commit 61d49bb

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

unit-testing/exercises/RPS.js

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

1919
return 'Player 1 wins!';
20-
}
20+
}
21+
22+
module.exports = {
23+
whoWon: whoWon
24+
};
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
});

0 commit comments

Comments
 (0)