From 41e2a50d85eb608f76c1d79273e74cef0d82ed05 Mon Sep 17 00:00:00 2001 From: Bart Riemens Date: Thu, 5 Sep 2019 22:57:50 +0200 Subject: [PATCH] Fix broken tests and added `npm run test-watch` to have jest run everytime a change is made --- package.json | 3 ++- src/redux/{module.js => Module.js} | 0 src/redux/highscore.spec.js | 15 +++++++++++---- 3 files changed, 13 insertions(+), 5 deletions(-) rename src/redux/{module.js => Module.js} (100%) diff --git a/package.json b/package.json index a9fd415..be401f2 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "dev": "webpack-dev-server --mode development --open", "build": "webpack --optimize-minimize --config webpack.production.config.js", "webpack": "webpack --config webpack.config.js --watch", - "test": "jest" + "test": "jest", + "test-watch": "jest --watch" }, "keywords": [], "author": "", diff --git a/src/redux/module.js b/src/redux/Module.js similarity index 100% rename from src/redux/module.js rename to src/redux/Module.js diff --git a/src/redux/highscore.spec.js b/src/redux/highscore.spec.js index b060e7a..587e685 100644 --- a/src/redux/highscore.spec.js +++ b/src/redux/highscore.spec.js @@ -30,7 +30,11 @@ const highscores = [ test("Register highscore where there is only 1 out 10 scores stored", () => { const result1 = reducers(undefined, registerHighscore({ name: "test", score: 10, gameId: 2 })); - expect(result1).toStrictEqual({ highscores: [{ name: "test", score: 10, gameId: 2 }], lastGameId: 2 }); + expect(result1).toStrictEqual({ + highscores: [{ name: "test", score: 10, gameId: 2 }], + lastGameId: 2, + lastUsername: "test" + }); }); test("Register highscore when there are more than 10 scores stored and the new score is not in the top 10", () => { @@ -50,7 +54,8 @@ test("Register highscore when there are more than 10 scores stored and the new s { name: "mock80", score: 80, gameId: 12 }, { name: "mock70", score: 70, gameId: 20 } ], - lastGameId: 8 + lastGameId: 8, + lastUsername: "test" }); }); @@ -69,7 +74,8 @@ test("Register highscore when there are more than 10 scores stored and the new s { name: "mock90", score: 90, gameId: 2 }, { name: "mock80", score: 80, gameId: 12 } ], - lastGameId: 3 + lastGameId: 3, + lastUsername: "test" }); }); @@ -88,7 +94,8 @@ test("Register highscore when there are more than 10 scores stored and the new s { name: "mock80", score: 80, gameId: 12 }, { name: "mock70", score: 70, gameId: 20 } ], - lastGameId: 99 + lastGameId: 99, + lastUsername: "test" }); });