Fix broken tests and added npm run test-watch to have jest run everytime a change is made
This commit is contained in:
@@ -7,7 +7,8 @@
|
|||||||
"dev": "webpack-dev-server --mode development --open",
|
"dev": "webpack-dev-server --mode development --open",
|
||||||
"build": "webpack --optimize-minimize --config webpack.production.config.js",
|
"build": "webpack --optimize-minimize --config webpack.production.config.js",
|
||||||
"webpack": "webpack --config webpack.config.js --watch",
|
"webpack": "webpack --config webpack.config.js --watch",
|
||||||
"test": "jest"
|
"test": "jest",
|
||||||
|
"test-watch": "jest --watch"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
|
|||||||
@@ -30,7 +30,11 @@ const highscores = [
|
|||||||
|
|
||||||
test("Register highscore where there is only 1 out 10 scores stored", () => {
|
test("Register highscore where there is only 1 out 10 scores stored", () => {
|
||||||
const result1 = reducers(undefined, registerHighscore({ name: "test", score: 10, gameId: 2 }));
|
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", () => {
|
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: "mock80", score: 80, gameId: 12 },
|
||||||
{ name: "mock70", score: 70, gameId: 20 }
|
{ 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: "mock90", score: 90, gameId: 2 },
|
||||||
{ name: "mock80", score: 80, gameId: 12 }
|
{ 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: "mock80", score: 80, gameId: 12 },
|
||||||
{ name: "mock70", score: 70, gameId: 20 }
|
{ name: "mock70", score: 70, gameId: 20 }
|
||||||
],
|
],
|
||||||
lastGameId: 99
|
lastGameId: 99,
|
||||||
|
lastUsername: "test"
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user