diff --git a/src/sagas/signoff.ts b/src/sagas/signoff.ts index fd2feaa61..2c0263a45 100644 --- a/src/sagas/signoff.ts +++ b/src/sagas/signoff.ts @@ -153,6 +153,7 @@ export function* onCollectionRecordsRequest( console.warn(ex); } else { console.error(ex); + notifyError("Error received when requesting signoff info from server."); } } } diff --git a/test/sagas/signoff_test.js b/test/sagas/signoff_test.js index 508357c5c..91f906508 100644 --- a/test/sagas/signoff_test.js +++ b/test/sagas/signoff_test.js @@ -1,11 +1,19 @@ import { call, put } from "redux-saga/effects"; -import { notifySuccess } from "../../src/actions/notifications"; +import { notifySuccess, notifyError } from "../../src/actions/notifications"; import { routeLoadSuccess } from "../../src/actions/route"; import { setClient } from "../../src/client"; import * as actions from "../../src/actions/signoff"; import * as collection_actions from "../../src/actions/collection"; import * as saga from "../../src/sagas/signoff"; +jest.mock("../../src/actions/notifications", () => { + const original = jest.requireActual("../../src/actions/notifications"); + return { + ...original, + notifyError: jest.fn(), + }; +}); + describe("Signoff sagas", () => { describe("list hook", () => { let getState; @@ -225,6 +233,7 @@ describe("Signoff sagas", () => { expect(result.next().value).toBeUndefined(); expect(console.warn).toHaveBeenCalledTimes(1); expect(console.error).toHaveBeenCalledTimes(0); + expect(notifyError).toHaveBeenCalledTimes(0); }); it("Should catch and log an error if an error (not 401) response is received", () => { @@ -246,6 +255,7 @@ describe("Signoff sagas", () => { expect(result.next().value).toBeUndefined(); expect(console.warn).toHaveBeenCalledTimes(0); expect(console.error).toHaveBeenCalledTimes(1); + expect(notifyError).toHaveBeenCalledTimes(1); }); }); });