Move board.js into components/ as Board.js

This commit is contained in:
Sage Vaillancourt 2022-10-12 23:03:23 -04:00
parent c111a16a34
commit 7fd455fe6d
3 changed files with 6 additions and 5 deletions

View File

@ -2,8 +2,8 @@ import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import renderer from 'react-test-renderer'; import renderer from 'react-test-renderer';
import Board from './board'; import Board from './components/Board';
import * as game from './board'; import * as game from './components/Board';
it('detects friendship and enemyship', () => { it('detects friendship and enemyship', () => {
const black = new game.Piece(game.BLACK, game.KING); const black = new game.Piece(game.BLACK, game.KING);
@ -84,6 +84,7 @@ it('detects an obvious checkmate', () => {
]; ];
const board = new Board({text: rows.join('')}); const board = new Board({text: rows.join('')});
const inCheck = board.whoInCheck(); const inCheck = board.whoInCheck();
expect(board.checkmate()).toBe(true)
expect(inCheck.type).toEqual(game.KING); expect(inCheck.type).toEqual(game.KING);
expect(inCheck.color).toEqual(game.BLACK); expect(inCheck.color).toEqual(game.BLACK);
}); });

View File

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import Popup from './components/Popup'; import Popup from './Popup';
import './index.css'; import '../index.css';
const BLACK = 0; const BLACK = 0;

View File

@ -2,7 +2,7 @@ import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import io from 'socket.io-client'; import io from 'socket.io-client';
import Board from './board'; import Board from './components/Board';
import './index.css'; import './index.css';