Add tests for lookupVinByImage action.
This commit is contained in:
parent
e06be65e34
commit
8cd86fd6c2
1 changed files with 31 additions and 0 deletions
|
|
@ -403,6 +403,37 @@ describe("Actions", () => {
|
||||||
expect(response.data).toEqual({ carId: "C00000001" });
|
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 () => {
|
it("getVehicleMakes action, should return makes list", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const context = state;
|
const context = state;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue