test(cli): use lightweight clears in message helper and gateway chat setup

This commit is contained in:
Peter Steinberger
2026-02-22 00:23:08 +00:00
parent 735fc23faf
commit f28fcf243a
2 changed files with 9 additions and 9 deletions

View File

@@ -83,11 +83,11 @@ function expectNoAccountFieldInPassedOptions() {
describe("runMessageAction", () => {
beforeEach(() => {
vi.clearAllMocks();
messageCommandMock.mockReset().mockResolvedValue(undefined);
hasHooksMock.mockReset().mockReturnValue(false);
runGatewayStopMock.mockReset().mockResolvedValue(undefined);
messageCommandMock.mockClear().mockResolvedValue(undefined);
hasHooksMock.mockClear().mockReturnValue(false);
runGatewayStopMock.mockClear().mockResolvedValue(undefined);
runGlobalGatewayStopSafelyMock.mockClear();
exitMock.mockReset().mockImplementation((): never => {
exitMock.mockClear().mockImplementation((): never => {
throw new Error("exit");
});
});
@@ -156,7 +156,7 @@ describe("runMessageAction", () => {
it("does not call exit(0) if the error path returns", async () => {
messageCommandMock.mockRejectedValueOnce(new Error("boom"));
exitMock.mockReset().mockImplementation(() => undefined as never);
exitMock.mockClear().mockImplementation(() => undefined as never);
const runMessageAction = createRunMessageAction();
await expect(runMessageAction("send", baseSendOptions)).resolves.toBeUndefined();