Update unit tests.

This commit is contained in:
Chloe Herd 2023-04-26 16:36:53 -04:00
parent 4a6b3fc147
commit 06ec6dbcb2

View file

@ -406,14 +406,16 @@ describe("Actions", () => {
it("lookupVinByImage action, should return list of vins", async () => {
// Arrange
const context = state;
const dummyImage = {};
const image = new File([], "test.jpg", {
type: "image/jpeg",
});
globalMethods.callHttpClient.mockImplementation(() => {
return Promise.resolve({ data: ["1C6JJTAG3NL134044"] });
});
// Act
const response = await actions.lookupVinByImage(context, dummyImage);
const response = await actions.lookupVinByImage(context, image);
// Assert
expect(response.data).toEqual(["1C6JJTAG3NL134044"]);
@ -422,7 +424,9 @@ describe("Actions", () => {
it("lookupVinByImage action, should reject if error in calling API", async () => {
// Arrange
const context = state;
const dummyImage = {};
const image = new File([], "test.jpg", {
type: "image/jpeg",
});
globalMethods.callHttpClient.mockImplementation(() => {
return Promise.reject("An error occurred");
@ -431,9 +435,7 @@ describe("Actions", () => {
// Act
// Assert
await expect(actions.lookupVinByImage(context, dummyImage)).rejects.toEqual(
"An error occurred"
);
await expect(actions.lookupVinByImage(context, image)).rejects.toEqual("An error occurred");
});
it("getVehicleMakes action, should return makes list", async () => {