Fix useJailDetail mocked command responses to match JailCommandResponse type

This commit is contained in:
2026-03-22 21:46:01 +01:00
parent 0663740b08
commit 965cdd765b

View File

@@ -36,7 +36,7 @@ describe("useJailDetail control methods", () => {
}); });
it("calls start() and refetches jail data", async () => { it("calls start() and refetches jail data", async () => {
vi.mocked(jailsApi.startJail).mockResolvedValue(undefined); vi.mocked(jailsApi.startJail).mockResolvedValue({ message: "jail started", jail: "sshd" });
const { result } = renderHook(() => useJailDetail("sshd")); const { result } = renderHook(() => useJailDetail("sshd"));
@@ -58,7 +58,7 @@ describe("useJailDetail control methods", () => {
}); });
it("calls stop() and refetches jail data", async () => { it("calls stop() and refetches jail data", async () => {
vi.mocked(jailsApi.stopJail).mockResolvedValue(undefined); vi.mocked(jailsApi.stopJail).mockResolvedValue({ message: "jail stopped", jail: "sshd" });
const { result } = renderHook(() => useJailDetail("sshd")); const { result } = renderHook(() => useJailDetail("sshd"));
@@ -77,7 +77,7 @@ describe("useJailDetail control methods", () => {
}); });
it("calls reload() and refetches jail data", async () => { it("calls reload() and refetches jail data", async () => {
vi.mocked(jailsApi.reloadJail).mockResolvedValue(undefined); vi.mocked(jailsApi.reloadJail).mockResolvedValue({ message: "jail reloaded", jail: "sshd" });
const { result } = renderHook(() => useJailDetail("sshd")); const { result } = renderHook(() => useJailDetail("sshd"));
@@ -96,7 +96,7 @@ describe("useJailDetail control methods", () => {
}); });
it("calls setIdle() with correct parameter and refetches jail data", async () => { it("calls setIdle() with correct parameter and refetches jail data", async () => {
vi.mocked(jailsApi.setJailIdle).mockResolvedValue(undefined); vi.mocked(jailsApi.setJailIdle).mockResolvedValue({ message: "jail idle toggled", jail: "sshd" });
const { result } = renderHook(() => useJailDetail("sshd")); const { result } = renderHook(() => useJailDetail("sshd"));