|
@ -3,11 +3,11 @@ const { |
|
|
PlayerBuilder, |
|
|
PlayerBuilder, |
|
|
buildPlayerArray, |
|
|
buildPlayerArray, |
|
|
movePlayer, |
|
|
movePlayer, |
|
|
over100 |
|
|
|
|
|
|
|
|
over100, |
|
|
|
|
|
landedOn |
|
|
} = require('../js/playerHandling'); |
|
|
} = require('../js/playerHandling'); |
|
|
|
|
|
|
|
|
let player = {"position": 1, "newPosition": 1, "won": false}; |
|
|
let player = {"position": 1, "newPosition": 1, "won": false}; |
|
|
|
|
|
|
|
|
//example player array
|
|
|
//example player array
|
|
|
let playerArr2 = [ |
|
|
let playerArr2 = [ |
|
|
{"position": 1, "newPosition": 1, "won": false}, |
|
|
{"position": 1, "newPosition": 1, "won": false}, |
|
@ -29,6 +29,20 @@ let playerArr4 = [ |
|
|
] |
|
|
] |
|
|
let rolls =[1,2,3,4,5,6]; |
|
|
let rolls =[1,2,3,4,5,6]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let ladderArr = ( |
|
|
|
|
|
{start: 7, end: 33}, |
|
|
|
|
|
{start: 24, end: 44}, |
|
|
|
|
|
{start: 31, end: 55}, |
|
|
|
|
|
{start: 60, end: 77} |
|
|
|
|
|
) |
|
|
|
|
|
let snakeArr = ( |
|
|
|
|
|
{start: 99, end: 56}, |
|
|
|
|
|
{start: 86, end: 64}, |
|
|
|
|
|
{start: 60, end: 28}, |
|
|
|
|
|
{start: 18, end: 1} |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
//Eine Test Gruppe, mit mehreren Tests
|
|
|
//Eine Test Gruppe, mit mehreren Tests
|
|
|
describe('Testen, ob für jede mögliche Spieleranzahl die richtige Anzahl von Spielerobjekten erzeugt wird', () => { |
|
|
describe('Testen, ob für jede mögliche Spieleranzahl die richtige Anzahl von Spielerobjekten erzeugt wird', () => { |
|
|
|
|
|
|
|
@ -56,10 +70,10 @@ describe('Testen ob das movePlayer funkction:', () => { |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Eine Test Gruppe, mit mehreren Tests
|
|
|
|
|
|
|
|
|
|
|
|
describe('Testen, ob der Spieler in einer Position über 100 sein kann', () => { |
|
|
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', ()=>{ |
|
|
it('101 bis 130 wieder auf 100 setzen', ()=>{ |
|
|
for(let i = 1; i <30; i++){ |
|
|
for(let i = 1; i <30; i++){ |
|
|
let player = {"position": 1, "newPosition": 100, "won": false}; |
|
|
let player = {"position": 1, "newPosition": 100, "won": false}; |
|
@ -70,3 +84,25 @@ describe('Testen, ob der Spieler in einer Position über 100 sein kann', () => { |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe('tests testen', () => { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it('testen alle leitern', ()=>{ |
|
|
|
|
|
for(let i = 0; i <= ladderArr.length; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
landedOn(player, ladderArr[i]); |
|
|
|
|
|
expect(player).toBe({"position": 1, "newPosition": ladderArr[i].end, "won": false}); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
it('testen alle schlange', ()=>{ |
|
|
|
|
|
|
|
|
|
|
|
for(let i = 0; i <= snakeArr.length; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
landedOn(player, snakeArr[i]); |
|
|
|
|
|
expect(player).toBe({"position": 1, "newPosition": ladderArr[i].end, "won": false}); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
}) |