Add test for vehicle-review
This commit is contained in:
parent
3164dcefd5
commit
a284821444
1 changed files with 35 additions and 1 deletions
|
|
@ -1,3 +1,37 @@
|
|||
import { shallowMount } from "@vue/test-utils";
|
||||
import { getMountOptions } from "@/helpers/unit-test-helper.js";
|
||||
import store from "@/store";
|
||||
import vehicleReview from "@/layouts/review/review-sections/vehicle-review/vehicle-review";
|
||||
|
||||
jest.mock("@/helpers/cms-content-helper", () => ({
|
||||
fetchCmsContentForPage: () => Promise.resolve("content"),
|
||||
}));
|
||||
|
||||
describe("Vehicle Review Block", () => {
|
||||
test.todo("Add more tests as specific functionality is added.");
|
||||
test("Correctly assembles vehicle info into a display string", async () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({
|
||||
propsData: {
|
||||
vehicle: {
|
||||
year: "2019",
|
||||
make: "Honda",
|
||||
model: "Odyssey",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// Act
|
||||
await wrapper.vm.$nextTick();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.displayContent).toStrictEqual(["2019 Honda Odyssey"]);
|
||||
});
|
||||
});
|
||||
|
||||
function setupMocks(customMountOptions) {
|
||||
const mountOptions = getMountOptions(customMountOptions);
|
||||
|
||||
const wrapper = shallowMount(vehicleReview, mountOptions);
|
||||
wrapper.vm.setCmsContent = jest.fn();
|
||||
return { wrapper };
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue