@dxos/react-ui-gameboard 0.8.3 → 0.8.4-main.1068cf700f

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/lib/browser/index.mjs +764 -825
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/lib/node-esm/index.mjs +764 -825
  5. package/dist/lib/node-esm/index.mjs.map +4 -4
  6. package/dist/lib/node-esm/meta.json +1 -1
  7. package/dist/types/src/components/Chessboard/Chessboard.d.ts +20 -0
  8. package/dist/types/src/components/Chessboard/Chessboard.d.ts.map +1 -0
  9. package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts +30 -0
  10. package/dist/types/src/components/Chessboard/Chessboard.stories.d.ts.map +1 -0
  11. package/dist/types/src/components/Chessboard/chess.d.ts +60 -0
  12. package/dist/types/src/components/Chessboard/chess.d.ts.map +1 -0
  13. package/dist/types/src/components/Chessboard/chess.test.d.ts +2 -0
  14. package/dist/types/src/components/Chessboard/chess.test.d.ts.map +1 -0
  15. package/dist/types/src/components/Chessboard/index.d.ts.map +1 -0
  16. package/dist/types/src/components/Gameboard/Gameboard.d.ts +38 -0
  17. package/dist/types/src/components/Gameboard/Gameboard.d.ts.map +1 -0
  18. package/dist/types/src/{Board → components/Gameboard}/Piece.d.ts +3 -2
  19. package/dist/types/src/components/Gameboard/Piece.d.ts.map +1 -0
  20. package/dist/types/src/components/Gameboard/Square.d.ts.map +1 -0
  21. package/dist/types/src/components/Gameboard/index.d.ts +4 -0
  22. package/dist/types/src/components/Gameboard/index.d.ts.map +1 -0
  23. package/dist/types/src/{Board → components/Gameboard}/types.d.ts +4 -3
  24. package/dist/types/src/components/Gameboard/types.d.ts.map +1 -0
  25. package/dist/types/src/components/Gameboard/util.d.ts.map +1 -0
  26. package/dist/types/src/components/index.d.ts +3 -0
  27. package/dist/types/src/components/index.d.ts.map +1 -0
  28. package/dist/types/src/index.d.ts +1 -2
  29. package/dist/types/src/index.d.ts.map +1 -1
  30. package/dist/types/tsconfig.tsbuildinfo +1 -1
  31. package/package.json +32 -24
  32. package/src/components/Chessboard/Chessboard.stories.tsx +113 -0
  33. package/src/components/Chessboard/Chessboard.tsx +206 -0
  34. package/src/components/Chessboard/chess.test.ts +19 -0
  35. package/src/components/Chessboard/chess.ts +325 -0
  36. package/src/components/Gameboard/Gameboard.tsx +145 -0
  37. package/src/{Board → components/Gameboard}/Piece.tsx +27 -23
  38. package/src/{Board → components/Gameboard}/Square.tsx +8 -6
  39. package/src/components/Gameboard/index.ts +8 -0
  40. package/src/{Board → components/Gameboard}/types.ts +5 -3
  41. package/src/components/index.ts +6 -0
  42. package/src/index.ts +1 -2
  43. package/dist/lib/node/index.cjs +0 -1039
  44. package/dist/lib/node/index.cjs.map +0 -7
  45. package/dist/lib/node/meta.json +0 -1
  46. package/dist/types/src/Board/Board.d.ts +0 -15
  47. package/dist/types/src/Board/Board.d.ts.map +0 -1
  48. package/dist/types/src/Board/Container.d.ts +0 -14
  49. package/dist/types/src/Board/Container.d.ts.map +0 -1
  50. package/dist/types/src/Board/Piece.d.ts.map +0 -1
  51. package/dist/types/src/Board/Square.d.ts.map +0 -1
  52. package/dist/types/src/Board/context.d.ts +0 -10
  53. package/dist/types/src/Board/context.d.ts.map +0 -1
  54. package/dist/types/src/Board/index.d.ts +0 -8
  55. package/dist/types/src/Board/index.d.ts.map +0 -1
  56. package/dist/types/src/Board/types.d.ts.map +0 -1
  57. package/dist/types/src/Board/util.d.ts.map +0 -1
  58. package/dist/types/src/Chessboard/Chessboard.d.ts +0 -14
  59. package/dist/types/src/Chessboard/Chessboard.d.ts.map +0 -1
  60. package/dist/types/src/Chessboard/Chessboard.stories.d.ts +0 -16
  61. package/dist/types/src/Chessboard/Chessboard.stories.d.ts.map +0 -1
  62. package/dist/types/src/Chessboard/chess.d.ts +0 -40
  63. package/dist/types/src/Chessboard/chess.d.ts.map +0 -1
  64. package/dist/types/src/Chessboard/index.d.ts.map +0 -1
  65. package/src/Board/Board.tsx +0 -86
  66. package/src/Board/Container.tsx +0 -25
  67. package/src/Board/context.ts +0 -22
  68. package/src/Board/index.ts +0 -12
  69. package/src/Chessboard/Chessboard.stories.tsx +0 -108
  70. package/src/Chessboard/Chessboard.tsx +0 -190
  71. package/src/Chessboard/chess.ts +0 -213
  72. /package/dist/types/src/{Chessboard → components/Chessboard}/index.d.ts +0 -0
  73. /package/dist/types/src/{Board → components/Gameboard}/Square.d.ts +0 -0
  74. /package/dist/types/src/{Board → components/Gameboard}/util.d.ts +0 -0
  75. /package/src/{Chessboard → components/Chessboard}/index.ts +0 -0
  76. /package/src/{Board → components/Gameboard}/util.ts +0 -0
package/package.json CHANGED
@@ -1,55 +1,63 @@
1
1
  {
2
2
  "name": "@dxos/react-ui-gameboard",
3
- "version": "0.8.3",
3
+ "version": "0.8.4-main.1068cf700f",
4
4
  "description": "Game board.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/dxos/dxos"
10
+ },
7
11
  "license": "MIT",
8
12
  "author": "DXOS.org",
9
13
  "type": "module",
10
14
  "exports": {
11
15
  ".": {
16
+ "source": "./src/index.ts",
12
17
  "types": "./dist/types/src/index.d.ts",
13
18
  "browser": "./dist/lib/browser/index.mjs",
14
19
  "node": "./dist/lib/node-esm/index.mjs"
15
20
  }
16
21
  },
17
22
  "types": "dist/types/src/index.d.ts",
23
+ "typesVersions": {
24
+ "*": {}
25
+ },
18
26
  "files": [
19
27
  "dist",
20
28
  "src"
21
29
  ],
22
30
  "dependencies": {
23
- "@atlaskit/pragmatic-drag-and-drop": "^1.4.0",
24
- "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.3",
25
- "@preact-signals/safe-react": "^0.9.0",
26
- "@preact/signals-core": "^1.9.0",
31
+ "@atlaskit/pragmatic-drag-and-drop": "1.7.7",
32
+ "@atlaskit/pragmatic-drag-and-drop-hitbox": "1.1.0",
33
+ "@effect-atom/atom-react": "^0.5.0",
34
+ "@radix-ui/react-context": "1.1.1",
27
35
  "chess.js": "^1.0.0",
28
36
  "react-resize-detector": "^11.0.1",
29
- "@dxos/debug": "0.8.3",
30
- "@dxos/invariant": "0.8.3",
31
- "@dxos/log": "0.8.3",
32
- "@dxos/node-std": "0.8.3",
33
- "@dxos/util": "0.8.3"
37
+ "@dxos/debug": "0.8.4-main.1068cf700f",
38
+ "@dxos/invariant": "0.8.4-main.1068cf700f",
39
+ "@dxos/node-std": "0.8.4-main.1068cf700f",
40
+ "@dxos/util": "0.8.4-main.1068cf700f",
41
+ "@dxos/log": "0.8.4-main.1068cf700f"
34
42
  },
35
43
  "devDependencies": {
36
44
  "@svgr/cli": "^8.1.0",
37
45
  "@types/lodash.defaultsdeep": "^4.6.6",
38
- "@types/react": "~18.2.0",
39
- "@types/react-dom": "~18.2.0",
46
+ "@types/react": "~19.2.7",
47
+ "@types/react-dom": "~19.2.3",
40
48
  "lodash.defaultsdeep": "^4.6.1",
41
- "react": "~18.2.0",
42
- "react-dom": "~18.2.0",
43
- "vite": "5.4.7",
44
- "@dxos/react-ui": "0.8.3",
45
- "@dxos/storybook-utils": "0.8.3",
46
- "@dxos/react-ui-theme": "0.8.3"
49
+ "react": "~19.2.3",
50
+ "react-dom": "~19.2.3",
51
+ "vite": "7.1.9",
52
+ "@dxos/react-ui": "0.8.4-main.1068cf700f",
53
+ "@dxos/storybook-utils": "0.8.4-main.1068cf700f",
54
+ "@dxos/ui-theme": "0.8.4-main.1068cf700f"
47
55
  },
48
56
  "peerDependencies": {
49
- "react": "~18.2.0",
50
- "react-dom": "~18.2.0",
51
- "@dxos/react-ui": "0.8.3",
52
- "@dxos/react-ui-theme": "0.8.3"
57
+ "react": "~19.2.3",
58
+ "react-dom": "~19.2.3",
59
+ "@dxos/react-ui": "0.8.4-main.1068cf700f",
60
+ "@dxos/ui-theme": "0.8.4-main.1068cf700f"
53
61
  },
54
62
  "publishConfig": {
55
63
  "access": "public"
@@ -57,7 +65,7 @@
57
65
  "scripts": {
58
66
  "gen:pieces": "pnpm gen:pieces:chess",
59
67
  "gen:pieces:chess": "pnpm gen:pieces:chess:alpha && pnpm gen:pieces:chess:cburnett",
60
- "gen:pieces:chess:alpha": "pnpm svgr --typescript --filename-case=camel --out-dir ./src/gen/pieces/chess/alpha ./assets/pieces/chess/alpha",
61
- "gen:pieces:chess:cburnett": "pnpm svgr --typescript --filename-case=camel --out-dir ./src/gen/pieces/chess/cburnett ./assets/pieces/chess/cburnett"
68
+ "gen:pieces:chess:alpha": "pnpm svgr --typescript --filename-case=camel --out-dir ./src/gen/pieces/chess/alpha ./assets/pieces/chess/alpha > /dev/null",
69
+ "gen:pieces:chess:cburnett": "pnpm svgr --typescript --filename-case=camel --out-dir ./src/gen/pieces/chess/cburnett ./assets/pieces/chess/cburnett > /dev/null"
62
70
  }
63
71
  }
@@ -0,0 +1,113 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import { RegistryContext } from '@effect-atom/atom-react';
6
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
7
+ import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react';
8
+
9
+ import { Button, Toolbar } from '@dxos/react-ui';
10
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
11
+ import { withRegistry } from '@dxos/storybook-utils';
12
+
13
+ import { Gameboard, type GameboardRootProps, type Move, type Player } from '../Gameboard';
14
+
15
+ import { ChessModel } from './chess';
16
+ import { Chessboard, type ChessboardProps } from './Chessboard';
17
+
18
+ type DefaultStoryProps = Pick<ChessboardProps, 'orientation' | 'showLabels' | 'debug'> & {
19
+ pgn?: string;
20
+ };
21
+
22
+ const DefaultStory = ({ orientation: _orientation, pgn, ...props }: DefaultStoryProps) => {
23
+ const registry = useContext(RegistryContext);
24
+ const model = useMemo(() => new ChessModel(registry, pgn), [registry, pgn]);
25
+ const [orientation, setOrientation] = useState<Player | undefined>(_orientation);
26
+
27
+ const handleDrop = useCallback<NonNullable<GameboardRootProps<ChessModel>['onDrop']>>(
28
+ (move: Move) => {
29
+ const result = model.makeMove(move);
30
+ console.log(model.pgn);
31
+ return result;
32
+ },
33
+ [model],
34
+ );
35
+
36
+ return (
37
+ <div className='flex flex-col grow gap-2 overflow-hidden'>
38
+ <Toolbar.Root>
39
+ <Button onClick={() => model.update()}>Reset</Button>
40
+ <Button onClick={() => model.makeRandomMove()}>Move</Button>
41
+ <div className='grow'></div>
42
+ <Button
43
+ onClick={() => setOrientation((orientation) => (!orientation || orientation === 'white' ? 'black' : 'white'))}
44
+ >
45
+ Toggle
46
+ </Button>
47
+ </Toolbar.Root>
48
+ <Gameboard.Root model={model} onDrop={handleDrop}>
49
+ <Gameboard.Content grow contain>
50
+ <Chessboard orientation={orientation} {...props} />
51
+ </Gameboard.Content>
52
+ </Gameboard.Root>
53
+ </div>
54
+ );
55
+ };
56
+
57
+ const GridStory = () => {
58
+ const registry = useContext(RegistryContext);
59
+ const models = useMemo(() => Array.from({ length: 9 }).map(() => new ChessModel(registry)), [registry]);
60
+ useEffect(() => {
61
+ const i = setInterval(() => {
62
+ const model = models[Math.floor(Math.random() * models.length)];
63
+ model.makeRandomMove();
64
+ }, 100);
65
+ return () => clearInterval(i);
66
+ }, []);
67
+
68
+ return (
69
+ <div className='bs-full aspect-square mx-auto'>
70
+ <div className='grid grid-cols-3 gap-2'>
71
+ {models.map((model, i) => (
72
+ <div key={i} className='aspect-square'>
73
+ <Gameboard.Root model={model}>
74
+ <Chessboard />
75
+ </Gameboard.Root>
76
+ </div>
77
+ ))}
78
+ </div>
79
+ </div>
80
+ );
81
+ };
82
+
83
+ const meta = {
84
+ title: 'ui/react-ui-gameboard/Chessboard',
85
+ component: Chessboard,
86
+ render: DefaultStory,
87
+ decorators: [withRegistry, withTheme(), withLayout({ layout: 'column' })],
88
+ } satisfies Meta<typeof Chessboard>;
89
+
90
+ export default meta;
91
+
92
+ type Story = StoryObj<typeof meta>;
93
+
94
+ export const Default: Story = {};
95
+
96
+ export const Promotion: Story = {
97
+ args: {
98
+ pgn: '1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5 4. c3 Nf6 5. d4 exd4 6. cxd4 Bb4+ 7. Nc3 d5 8. exd5 Nxd5 9. O-O Be6 10. Qb3 Na5 11. Qa4+ c6 12. Bxd5 Bxc3 13. Bxe6 fxe6 14. d5 Qg5 15. dxe6 Kf8 16. e7+ Kg8 *',
99
+ },
100
+ };
101
+
102
+ export const Debug: Story = {
103
+ args: {
104
+ pgn: '1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5 4. c3 Nf6 5. d4 exd4 6. cxd4 Bb4+ 7. Nc3 d5 8. exd5 Nxd5 9. O-O Be6 10. Qb3 Na5 11. Qa4+ c6 12. Bxd5 Bxc3 13. Bxe6 fxe6 *',
105
+ orientation: 'black',
106
+ showLabels: true,
107
+ debug: true,
108
+ },
109
+ };
110
+
111
+ export const Grid = {
112
+ render: GridStory,
113
+ };
@@ -0,0 +1,206 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Atom, useAtomValue } from '@effect-atom/atom-react';
6
+ import React, { type PropsWithChildren, forwardRef, memo, useEffect, useMemo, useRef, useState } from 'react';
7
+ import { useResizeDetector } from 'react-resize-detector';
8
+
9
+ import { type ThemedClassName, useForwardedRef } from '@dxos/react-ui';
10
+ import { mx } from '@dxos/ui-theme';
11
+ import { isNonNullable } from '@dxos/util';
12
+
13
+ import {
14
+ type DOMRectBounds,
15
+ Gameboard,
16
+ type Location,
17
+ type PieceMap,
18
+ type PieceRecord,
19
+ type Player,
20
+ getRelativeBounds,
21
+ locationToString,
22
+ useGameboardContext,
23
+ } from '../Gameboard';
24
+
25
+ import { type ChessModel, type ChessPiece, ChessPieces, boardStyles, getSquareColor, locationToPos } from './chess';
26
+
27
+ /** Fallback atom for when model is undefined. */
28
+ const EMPTY_PIECES_ATOM = Atom.make<PieceMap<ChessPiece>>({});
29
+
30
+ export type ChessboardProps = ThemedClassName<
31
+ PropsWithChildren<{
32
+ orientation?: Player;
33
+ showLabels?: boolean;
34
+ debug?: boolean;
35
+ rows?: number;
36
+ cols?: number;
37
+ }>
38
+ >;
39
+
40
+ /**
41
+ * Chessboard layout.
42
+ */
43
+ const CHESSBOARD_NAME = 'Chessboard';
44
+
45
+ const ChessboardComponent = forwardRef<HTMLDivElement, ChessboardProps>(
46
+ ({ classNames, orientation, showLabels, debug, rows = 8, cols = 8 }, forwardedRef) => {
47
+ const targetRef = useForwardedRef(forwardedRef);
48
+ const { width, height } = useResizeDetector({ targetRef, refreshRate: 200 });
49
+ const { model, promoting, onPromotion } = useGameboardContext<ChessModel>(CHESSBOARD_NAME);
50
+ const pieces = useAtomValue(model?.pieces ?? EMPTY_PIECES_ATOM);
51
+
52
+ // Board squares.
53
+ const squares = useMemo<Location[]>(() => {
54
+ return Array.from({ length: rows }, (_, i) => (orientation === 'black' ? i : rows - 1 - i)).flatMap((row) =>
55
+ Array.from({ length: cols }).map((_, col) => [row, col] as Location),
56
+ );
57
+ }, [orientation, rows, cols]);
58
+
59
+ // Use DOM grid layout to position squares.
60
+ const layout = useMemo(() => {
61
+ return squares.map((location) => {
62
+ return (
63
+ <div
64
+ key={locationToString(location)}
65
+ {...{
66
+ ['data-location' as const]: locationToString(location),
67
+ }}
68
+ />
69
+ );
70
+ });
71
+ }, [squares]);
72
+
73
+ // Build map of square locations to bounds.
74
+ const [grid, setGrid] = useState<Record<string, DOMRectBounds>>({});
75
+ const gridRef = useRef<HTMLDivElement>(null);
76
+ useEffect(() => {
77
+ setGrid(
78
+ squares.reduce(
79
+ (acc, location) => {
80
+ const square = getSquareLocation(gridRef.current!, location)!;
81
+ const bounds = getRelativeBounds(gridRef.current!, square);
82
+ return { ...acc, [locationToString(location)]: bounds };
83
+ },
84
+ {} as Record<string, DOMRectBounds>,
85
+ ),
86
+ );
87
+ }, [squares, width, height]);
88
+
89
+ // Get the bounds of each square and piece.
90
+ const positions = useMemo<{ piece: PieceRecord; bounds: DOMRectBounds }[]>(() => {
91
+ if (!gridRef.current) {
92
+ return [];
93
+ }
94
+
95
+ return Object.values(pieces)
96
+ .map((piece) => {
97
+ if (piece.id === promoting?.id) {
98
+ return null;
99
+ }
100
+
101
+ const bounds = grid[locationToString(piece.location)];
102
+ return { piece, bounds };
103
+ })
104
+ .filter(isNonNullable);
105
+ }, [grid, pieces, promoting]);
106
+
107
+ return (
108
+ <div ref={targetRef} tabIndex={0} className={mx('relative outline-none', classNames)}>
109
+ {/* DOM Layout. */}
110
+ <div ref={gridRef} className='grid grid-rows-8 grid-cols-8 aspect-square select-none'>
111
+ {layout}
112
+ </div>
113
+ {/* Squares. */}
114
+ <div>
115
+ {squares.map((location) => (
116
+ <Gameboard.Square
117
+ key={locationToString(location)}
118
+ location={location}
119
+ label={showLabels ? locationToPos(location) : undefined}
120
+ bounds={grid[locationToString(location)]}
121
+ classNames={getSquareColor(location)}
122
+ />
123
+ ))}
124
+ </div>
125
+ {/* Pieces. */}
126
+ <div className={mx(promoting && 'opacity-50')}>
127
+ {positions.map(({ bounds, piece }) => (
128
+ <Gameboard.Piece
129
+ key={piece.id}
130
+ piece={piece}
131
+ bounds={bounds}
132
+ label={debug ? piece.id : undefined}
133
+ orientation={orientation}
134
+ Component={ChessPieces[piece.type as ChessPiece]}
135
+ />
136
+ ))}
137
+ </div>
138
+ {/* Promotion selector. */}
139
+ {promoting && (
140
+ <PromotionSelector
141
+ grid={grid}
142
+ piece={promoting}
143
+ onSelect={(piece) => {
144
+ onPromotion({
145
+ from: Object.values(pieces).find((p) => p.id === promoting.id)!.location,
146
+ to: piece.location,
147
+ piece: promoting.type,
148
+ promotion: piece.type,
149
+ });
150
+ }}
151
+ />
152
+ )}
153
+ </div>
154
+ );
155
+ },
156
+ );
157
+
158
+ ChessboardComponent.displayName = CHESSBOARD_NAME;
159
+
160
+ export const Chessboard = memo(ChessboardComponent);
161
+
162
+ const PromotionSelector = ({
163
+ grid,
164
+ piece,
165
+ onSelect,
166
+ }: {
167
+ grid: Record<string, DOMRectBounds>;
168
+ piece: PieceRecord;
169
+ onSelect: (piece: PieceRecord) => void;
170
+ }) => {
171
+ const positions = ['Q', 'N', 'R', 'B'].map((pieceType, i) => {
172
+ const location = [piece.location[0] + (piece.location[0] === 0 ? i : -i), piece.location[1]] as Location;
173
+ return {
174
+ piece: {
175
+ id: `promotion-${pieceType}`,
176
+ type: (piece.side === 'black' ? 'B' : 'W') + pieceType,
177
+ side: piece.side,
178
+ location,
179
+ },
180
+ bounds: grid[locationToString(location)],
181
+ };
182
+ });
183
+
184
+ const handleSelect = (selected: PieceRecord) => {
185
+ onSelect({ ...piece, type: selected.type });
186
+ };
187
+
188
+ return (
189
+ <>
190
+ {positions.map(({ piece, bounds }) => (
191
+ <Gameboard.Piece
192
+ key={piece.id}
193
+ classNames={mx('border-2 border-neutral-700 rounded-full', boardStyles.promotion)}
194
+ piece={piece}
195
+ bounds={bounds}
196
+ Component={ChessPieces[piece.type as ChessPiece]}
197
+ onClick={() => handleSelect(piece)}
198
+ />
199
+ ))}
200
+ </>
201
+ );
202
+ };
203
+
204
+ const getSquareLocation = (container: HTMLElement, location: Location): HTMLElement | null => {
205
+ return container.querySelector(`[data-location="${locationToString(location)}"]`);
206
+ };
@@ -0,0 +1,19 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Chess as ChessJS } from 'chess.js';
6
+ import { describe, it } from 'vitest';
7
+
8
+ import { createPieceMap } from './chess';
9
+
10
+ describe('ChessModel', () => {
11
+ it('should update pieces', ({ expect }) => {
12
+ const chess = new ChessJS();
13
+ chess.loadPgn(
14
+ '1. e4 e5 2. Nf3 Nc6 3. Bc4 Bc5 4. c3 Nf6 5. d4 exd4 6. cxd4 Bb4+ 7. Nc3 d5 8. exd5 Nxd5 9. O-O Be6 10. Qb3 Na5 11. Qa4+ c6 12. Bxd5 Bxc3 13. Bxe6 fxe6 *',
15
+ );
16
+ const pieces = createPieceMap(chess);
17
+ expect(pieces).to.exist;
18
+ });
19
+ });