test: verify install and runtime messages

This commit is contained in:
Shakker
2026-05-11 17:16:15 +01:00
parent b3a9eba793
commit 8f79e34cbe
8 changed files with 31 additions and 15 deletions

View File

@@ -1,5 +1,6 @@
import { Command } from "commander";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { theme } from "../terminal/theme.js";
import { registerPairingCli } from "./pairing-cli.js";
const mocks = vi.hoisted(() => ({
@@ -229,8 +230,12 @@ describe("pairing cli", () => {
| { nextConfig?: { commands?: { ownerAllowFrom?: string[] } } }
| undefined;
expect(replaceCall?.nextConfig?.commands?.ownerAllowFrom).toEqual(["telegram:123"]);
expect(log).toHaveBeenCalledWith(expect.stringContaining("Approved"));
expect(log).toHaveBeenCalledWith(expect.stringContaining("Command owner configured"));
expect(log.mock.calls).toEqual([
[`${theme.success("Approved")} ${theme.muted("telegram")} sender ${theme.command("123")}.`],
[
`${theme.success("Command owner configured")} ${theme.command("telegram:123")} ${theme.muted("(commands.ownerAllowFrom was empty).")}`,
],
]);
} finally {
log.mockRestore();
}