diff --git a/src/store/store.spec.js b/src/store/store.spec.js index 06f0cb746..2a364243a 100644 --- a/src/store/store.spec.js +++ b/src/store/store.spec.js @@ -403,6 +403,37 @@ describe("Actions", () => { expect(response.data).toEqual({ carId: "C00000001" }); }); + it("lookupVinByImage action, should return list of vins", async () => { + // Arrange + const context = state; + const dummyImage = {}; + + globalMethods.callHttpClient.mockImplementation(() => { + return Promise.resolve({ data: [ "1C6JJTAG3NL134044" ] }); + }); + + // Act + const response = await actions.lookupVinByImage(context, dummyImage); + + // Assert + expect(response.data).toEqual([ "1C6JJTAG3NL134044" ]); + }); + + it("lookupVinByImage action, should reject if error in calling API", async () => { + // Arrange + const context = state; + const dummyImage = {}; + + globalMethods.callHttpClient.mockImplementation(() => { + return Promise.reject("An error occurred"); + }); + + // Act + + // Assert + await expect(actions.lookupVinByImage(context, dummyImage)).rejects.toEqual("An error occurred"); + }); + it("getVehicleMakes action, should return makes list", async () => { // Arrange const context = state;