From 9a321c9cf5a55e5a0b887837aec440697f12c23b Mon Sep 17 00:00:00 2001 From: Richard Halsall <–richard-glyn.halsall@informatik.hs-fulda.e> Date: Thu, 9 Feb 2023 15:06:05 +0100 Subject: [PATCH] =?UTF-8?q?test:=20Pr=C3=BCfung,=20ob=20der=20Spieler=20di?= =?UTF-8?q?e=20maximale=20Position=20=C3=BCberschreiten=20kann?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- schlangen_und_leitern/js/playerHandling.js | 3 +- .../tests/playerHandling.test.js | 32 ++++++++++++++++--- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/schlangen_und_leitern/js/playerHandling.js b/schlangen_und_leitern/js/playerHandling.js index a484bae..386980c 100644 --- a/schlangen_und_leitern/js/playerHandling.js +++ b/schlangen_und_leitern/js/playerHandling.js @@ -217,5 +217,6 @@ function landedOn (player, objectArr){ module.exports = { PlayerBuilder, buildPlayerArray, - movePlayer + movePlayer, + over100 } \ No newline at end of file diff --git a/schlangen_und_leitern/tests/playerHandling.test.js b/schlangen_und_leitern/tests/playerHandling.test.js index a06dc66..29bdb33 100644 --- a/schlangen_und_leitern/tests/playerHandling.test.js +++ b/schlangen_und_leitern/tests/playerHandling.test.js @@ -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 { + + //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}); } + }); -}) \ No newline at end of file +})