1
0
Files
test-kata-machine/src/day1/PrimsList.test.ts
2025-12-17 07:57:42 +00:00

31 lines
722 B
TypeScript

import prims from "@code/PrimsAlgorithm";
import { list1 } from "./graph";
test("PrimsAlgorithm", function () {
// there is only one right answer for this graph
expect(prims(list1)).toEqual([
[
{ to: 2, weight: 1 },
{ to: 1, weight: 3 },
],
[
{ to: 0, weight: 3 },
{ to: 4, weight: 1 },
],
[{ to: 0, weight: 1 }],
[{ to: 6, weight: 1 }],
[
{ to: 1, weight: 1 },
{ to: 5, weight: 2 },
],
[
{ to: 4, weight: 2 },
{ to: 6, weight: 1 },
],
[
{ to: 5, weight: 1 },
{ to: 3, weight: 1 },
],
]);
});