From 7fd455fe6d41bae0f417530c52bc74c9929d2d17 Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Wed, 12 Oct 2022 23:03:23 -0400 Subject: [PATCH] Move board.js into components/ as Board.js --- src/board.test.js | 5 +++-- src/{board.js => components/Board.js} | 4 ++-- src/index.js | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) rename src/{board.js => components/Board.js} (99%) diff --git a/src/board.test.js b/src/board.test.js index 6e31ccf..ff1bff2 100644 --- a/src/board.test.js +++ b/src/board.test.js @@ -2,8 +2,8 @@ import React from 'react'; import ReactDOM from 'react-dom'; import renderer from 'react-test-renderer'; -import Board from './board'; -import * as game from './board'; +import Board from './components/Board'; +import * as game from './components/Board'; it('detects friendship and enemyship', () => { 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 inCheck = board.whoInCheck(); + expect(board.checkmate()).toBe(true) expect(inCheck.type).toEqual(game.KING); expect(inCheck.color).toEqual(game.BLACK); }); diff --git a/src/board.js b/src/components/Board.js similarity index 99% rename from src/board.js rename to src/components/Board.js index bc034e8..0108a6f 100644 --- a/src/board.js +++ b/src/components/Board.js @@ -1,7 +1,7 @@ import React from 'react'; -import Popup from './components/Popup'; +import Popup from './Popup'; -import './index.css'; +import '../index.css'; const BLACK = 0; diff --git a/src/index.js b/src/index.js index d11fd5f..ae4a17b 100644 --- a/src/index.js +++ b/src/index.js @@ -2,7 +2,7 @@ import React from 'react'; import ReactDOM from 'react-dom'; import io from 'socket.io-client'; -import Board from './board'; +import Board from './components/Board'; import './index.css';