🚀 add test on samples

This commit is contained in:
platane
2020-10-24 10:48:49 +02:00
parent a9c2cbc763
commit b2ac63d6ef

View File

@@ -1,6 +1,8 @@
import { getBestRoute } from "../getBestRoute";
import { Color, createEmptyGrid, setColor } from "@snk/types/grid";
import { createSnakeFromCells, snakeToCells } from "@snk/types/snake";
import * as grids from "@snk/types/__fixtures__/grid";
import { snake3 } from "@snk/types/__fixtures__/snake";
it("should find best route", () => {
const snk0 = [
@@ -17,3 +19,8 @@ it("should find best route", () => {
expect(snakeToCells(chain[chain.length - 1])[0]).toEqual({ x: 3, y: 3 });
});
for (const [gridName, grid] of Object.entries(grids))
it(`should find a solution for ${gridName}`, () => {
getBestRoute(grid, snake3);
});