Update unit tests.
This commit is contained in:
parent
4a6b3fc147
commit
06ec6dbcb2
1 changed files with 8 additions and 6 deletions
|
|
@ -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 () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue