Raise test coverage to ~73%
This commit is contained in:
@@ -91,7 +91,7 @@ describe("sendCommand", () => {
|
||||
);
|
||||
expect(deps.sendMessageWeb).toHaveBeenCalled();
|
||||
expect(runtime.log).toHaveBeenCalledWith(
|
||||
expect.stringContaining("\"provider\": \"web\""),
|
||||
expect.stringContaining('"provider": "web"'),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -139,7 +139,7 @@ describe("sendCommand", () => {
|
||||
});
|
||||
expect(deps.waitForFinalStatus).not.toHaveBeenCalled();
|
||||
expect(runtime.log).toHaveBeenCalledWith(
|
||||
expect.stringContaining("\"provider\": \"twilio\""),
|
||||
expect.stringContaining('"provider": "twilio"'),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { RuntimeEnv } from "../runtime.js";
|
||||
import { statusCommand } from "./status.js";
|
||||
|
||||
vi.mock("../twilio/messages.js", () => ({
|
||||
formatMessageLine: (m: any) => `LINE:${m.sid}`,
|
||||
formatMessageLine: (m: { sid: string }) => `LINE:${m.sid}`,
|
||||
}));
|
||||
|
||||
const runtime: RuntimeEnv = {
|
||||
@@ -31,7 +31,7 @@ describe("statusCommand", () => {
|
||||
});
|
||||
|
||||
it("prints JSON when requested", async () => {
|
||||
(deps.listRecentMessages as any).mockResolvedValue([{ sid: "1" }]);
|
||||
(deps.listRecentMessages as jest.Mock).mockResolvedValue([{ sid: "1" }]);
|
||||
await statusCommand(
|
||||
{ limit: "5", lookback: "10", json: true },
|
||||
deps,
|
||||
@@ -43,7 +43,7 @@ describe("statusCommand", () => {
|
||||
});
|
||||
|
||||
it("prints formatted lines otherwise", async () => {
|
||||
(deps.listRecentMessages as any).mockResolvedValue([{ sid: "123" }]);
|
||||
(deps.listRecentMessages as jest.Mock).mockResolvedValue([{ sid: "123" }]);
|
||||
await statusCommand({ limit: "1", lookback: "5" }, deps, runtime);
|
||||
expect(runtime.log).toHaveBeenCalledWith("LINE:123");
|
||||
});
|
||||
|
||||
@@ -28,7 +28,7 @@ describe("webhookCommand", () => {
|
||||
it("logs dry run instead of starting server", async () => {
|
||||
runtime.log.mockClear();
|
||||
const res = await webhookCommand(
|
||||
{ port: "42873", path: "/hook", reply: "dry-run" },
|
||||
{ port: "42873", path: "/hook", reply: "dry-run", ingress: "none" },
|
||||
deps,
|
||||
runtime,
|
||||
);
|
||||
@@ -40,7 +40,13 @@ describe("webhookCommand", () => {
|
||||
|
||||
it("starts webhook when valid", async () => {
|
||||
const res = await webhookCommand(
|
||||
{ port: "42873", path: "/hook", reply: "ok", verbose: true },
|
||||
{
|
||||
port: "42873",
|
||||
path: "/hook",
|
||||
reply: "ok",
|
||||
verbose: true,
|
||||
ingress: "none",
|
||||
},
|
||||
deps,
|
||||
runtime,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user