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