Skip to content

Commit

Permalink
test: add further jest tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dvfrancis committed Oct 29, 2024
1 parent 69d07dc commit b75de0b
Show file tree
Hide file tree
Showing 5 changed files with 239 additions and 8 deletions.
4 changes: 0 additions & 4 deletions assets/scripts/tests/game.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
// assets/scripts/tests/index.test.js
test('should pass', () => {
expect(true).toBe(true);
});
2 changes: 1 addition & 1 deletion assets/scripts/tests/general.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe('updateCopyrightYear function', () => {
describe('updating the copyright year', () => {
beforeEach(() => {
document.body.innerHTML = '<div id="copyright"></div>'; // Create mock DOM element for testing
});
Expand Down
2 changes: 1 addition & 1 deletion assets/scripts/tests/index.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
describe('startGame function', () => {
describe('starting the game', () => {
beforeEach(() => {
document.body.innerHTML = '<input type="submit" id="play-game" value="PLAY">'; // Create mock DOM element for testing
delete window.location; // Remove current window object
Expand Down
235 changes: 234 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"devDependencies": {
"cross-fetch": "^4.0.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0"
"jest-environment-jsdom": "^29.7.0",
"node-fetch": "^3.3.2"
},
"scripts": {
"test": "jest"
Expand Down

0 comments on commit b75de0b

Please sign in to comment.