|
|
@ -1,5 +1,12 @@ |
|
|
|
//Importieren der FUnktionen
|
|
|
|
const { PlayerBuilder, buildPlayerArray, movePlayer } = require('../js/playerHandling'); |
|
|
|
const { |
|
|
|
PlayerBuilder, |
|
|
|
buildPlayerArray, |
|
|
|
movePlayer, |
|
|
|
over100 |
|
|
|
} = require('../js/playerHandling'); |
|
|
|
|
|
|
|
let player = {"position": 1, "newPosition": 1, "won": false}; |
|
|
|
|
|
|
|
//example player array
|
|
|
|
let playerArr2 = [ |
|
|
@ -41,10 +48,25 @@ describe('Testen ob das movePlayer funkction:', () => { |
|
|
|
it('die Position bei jeder möglichen Rolle korrekt ändert', ()=>{ |
|
|
|
for(let i = 0; i <rolls.length; i++) |
|
|
|
{ |
|
|
|
player = {"position": 1, "newPosition": 1, "won": false}; |
|
|
|
|
|
|
|
movePlayer(player, rolls[i]) |
|
|
|
expect(player).toEqual({"position": 1, "newPosition": 1 +rolls[i], "won": false}); |
|
|
|
} |
|
|
|
}); |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
//Eine Test Gruppe, mit mehreren Tests
|
|
|
|
describe('Testen, ob der Spieler in einer Position über 100 sein kann', () => { |
|
|
|
|
|
|
|
//Ein Test mit Name und Funktion
|
|
|
|
it('101 bis 130 wieder auf 100 setzen', ()=>{ |
|
|
|
for(let i = 1; i <30; i++){ |
|
|
|
let player = {"position": 1, "newPosition": 100, "won": false}; |
|
|
|
over100(player); |
|
|
|
expect(player).toEqual({"position": 1, "newPosition": 100, "won": false}); |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}) |