Skip to content

Commit

Permalink
Fix up tests.
Browse files Browse the repository at this point in the history
*shakes fist at nodejs/node#43583 *
  • Loading branch information
lgarron committed Nov 30, 2022
1 parent 19c32ce commit 7fb2382
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 34 deletions.
32 changes: 32 additions & 0 deletions src/js/dev/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { cube3x3x3 } from "cubing/puzzles";
import { setKPuzzleDefString, solveState, serializeDefToTws } from "..";

(async () => {
await setKPuzzleDefString(
serializeDefToTws(await cube3x3x3.kpuzzle(), {
moveSubset: ["U", "L", "F", "R", "B", "D"],
startState: `EDGES
0 0 0 0 1 2 3 4 5 6 7 8
0 0 0 0 0 0 0 0 0 0 0 0
CORNERS
0 0 0 0 1 2 3 4
0 0 0 0 0 0 0 0
CENTERS
0 1 2 3 4 5
0 0 0 0 0 0`,
}),
);
(
await solveState(`ScrambleState test
EDGES
0 0 0 0 1 2 3 4 5 6 7 8
1 1 1 1 0 0 0 0 0 0 0 0
CORNERS
0 0 0 0 1 2 3 4
0 0 0 0 0 0 0 0
CENTERS
0 1 2 3 4 5
0 0 0 0 0 0
End`)
).log();
})();
35 changes: 1 addition & 34 deletions src/js/dev/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,5 @@
export const workerURL = import.meta.url;

if (globalThis.WorkerGlobalScope) {
(async () => {
const [
{ cube3x3x3 },
{ setKPuzzleDefString, solveState, serializeDefToTws },
] = await Promise.all([import("cubing/puzzles"), import("..")]);

await setKPuzzleDefString(
serializeDefToTws(await cube3x3x3.kpuzzle(), {
moveSubset: ["U", "L", "F", "R", "B", "D"],
startState: `EDGES
0 0 0 0 1 2 3 4 5 6 7 8
0 0 0 0 0 0 0 0 0 0 0 0
CORNERS
0 0 0 0 1 2 3 4
0 0 0 0 0 0 0 0
CENTERS
0 1 2 3 4 5
0 0 0 0 0 0`,
}),
);
(
await solveState(`ScrambleState test
EDGES
0 0 0 0 1 2 3 4 5 6 7 8
1 1 1 1 0 0 0 0 0 0 0 0
CORNERS
0 0 0 0 1 2 3 4
0 0 0 0 0 0 0 0
CENTERS
0 1 2 3 4 5
0 0 0 0 0 0
End`)
).log();
})();
import("./test");
}

0 comments on commit 7fb2382

Please sign in to comment.