const words = parseInput(input);
const factors = getLowerFactors(words.length);
if (factors.length === 0) {
- console.log(
- `\nNo permutations found. Seed phrase of length ${words.length} can't be arranged into a grid.`,
+ console.error(
+ `%c\nNo permutations found. Seed phrase of length ${words.length} can't be arranged into a grid.`,
+ "color: red",
);
Deno.exit(0);
}
});
Deno.test("main exits cleanly on a malformed seed phrase", () => {
- const consoleSpy = spy(console, "log");
+ const consoleSpy = spy(console, "error");
const promptStub = stub(
globalThis,
"prompt",
);
assertThrows(main); // Calling Deno.exit() within a test throws an error
- assertSpyCalls(consoleSpy, 1); // console.log was called exactly 1 time
+ assertSpyCalls(consoleSpy, 1); // console.error was called exactly 1 time
consoleSpy.restore();
promptStub.restore();