UNPKG

scrabble-solver

Version:

Scrabble Solver 2 - Free, open-source, cross-platform, multi-language analysis tool for Scrabble, Scrabble Duel, Super Scrabble, Letter League, Crossplay, Literaki, and Kelimelik. Quickly find the top-scoring words using the given board and tiles.

20 lines (15 loc) 683 B
import { type Cell } from '@scrabble-solver/types'; import { generateStartIndices } from './generateStartIndices'; describe('generateStartIndices', () => { const emptyCell: Cell = { hasTile: () => false } as Cell; const filledCell: Cell = { hasTile: () => true } as Cell; it('returns empty array when no cells given', () => { const cells: Cell[] = []; expect(generateStartIndices(cells).length).toBe(0); }); it('finds indices where a new word can start', () => { const cells = [filledCell, filledCell, emptyCell, emptyCell, emptyCell, filledCell]; const startIndices = generateStartIndices(cells); expect(startIndices).toEqual([0, 3, 4]); }); });