-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
setup jest environment and update gitignore
- Loading branch information
Showing
5 changed files
with
87 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,13 @@ | ||
testing/__pycache__/test_server.cpython-310-pytest-7.4.3.pyc | ||
# Python | ||
__pycache__/ | ||
testing/__pycache__/ | ||
*.pyc | ||
|
||
# Node.js | ||
node_modules/ | ||
npm-debug.log | ||
|
||
# Jest | ||
coverage/ | ||
.venv/ | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
testEnvironment: 'jsdom', | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "thebubblebots", | ||
"version": "0.2.0", | ||
"description": "checkers against ai", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "jest" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/N1ckP3rsl3y/TheBubbleBots.git" | ||
}, | ||
"keywords": [ | ||
"checkers", | ||
"ai", | ||
"server" | ||
], | ||
"author": "Nicholas Persley, Nicholas Robishaw, Elian Zamora-Rivera, Jeysen Angous, Tyler Chapp, Ibrahim Hmood", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/N1ckP3rsl3y/TheBubbleBots/issues" | ||
}, | ||
"homepage": "https://github.com/N1ckP3rsl3y/TheBubbleBots#readme" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// __tests__/index.test.js | ||
|
||
const { JSDOM } = require('jsdom'); | ||
|
||
// load the HTML content -- UPDATE LATER | ||
const html = '<!DOCTYPE html><html><head></head><body><div id="gameboard"></div></body></html>'; | ||
const { window } = new JSDOM(html); | ||
global.document = window.document; | ||
|
||
// load the js file -- UPDATE PATH LATER | ||
require('../src/index.js'); | ||
|
||
test('Board and pieces are drawn correctly', () => { | ||
// assuming you have elements with data-testid attributes | ||
const gameBoard = document.querySelector('[data-testid="game-board"]'); | ||
const redPiece = document.querySelector('[data-testid="red-piece"]'); | ||
const blackPiece = document.querySelector('[data-testid="black-piece"]'); | ||
|
||
// assert that the elements exist | ||
expect(gameBoard).toBeTruthy(); | ||
expect(redPiece).toBeTruthy(); | ||
expect(blackPiece).toBeTruthy(); | ||
|
||
}); |