import { step, countNeighbors } from '../index'; describe('Game of Life', () => { test('countNeighbors counts the number of live neighbors', () => { const grid = [ [false, true, false], [false, true, false], [false, true, false] ]; expect(countNeighbors(grid, 1, 1)).toBe(2); expect(countNeighbors(grid, 0, 0)).toBe(1); }); test('step advances the game by one step', () => { const initial = [ [false, true, false], [false, true, false], [false, true, false] ]; const expected = [ [false, true, false], [false, true, false], [false, true, false] ]; expect(step(initial)).toEqual(expected); }); });