42 lines
1.2 KiB
JavaScript
42 lines
1.2 KiB
JavaScript
import vinPagesMixin from "@/mixins/vin-pages-mixin";
|
|
import { shallowMount } from "@vue/test-utils";
|
|
import { getMountOptions } from "@/helpers/unit-test-helper.js";
|
|
import vehicleQuestionsMixin from "@/mixins/vehicle-questions-mixin";
|
|
import { useMainStore } from "@/store";
|
|
|
|
describe("vin-pages-mixin", () => {
|
|
afterEach(() => {
|
|
jest.clearAllMocks();
|
|
});
|
|
|
|
describe("navigateForwardWithSingleCarMatch", () => {
|
|
test("should navigateForward", async () => {
|
|
// Arrange
|
|
useMainStore().getPartsOrQuestions = () => { return { data: {partsOrQuestions: {}}} };
|
|
const { wrapper } = setupMocks({});
|
|
vehicleQuestionsMixin.methods.navigateForward = jest.fn();
|
|
|
|
// Act
|
|
await wrapper.vm.navigateForwardWithSingleCarMatch();
|
|
|
|
// Assert
|
|
expect(vehicleQuestionsMixin.methods.navigateForward).toHaveBeenCalled();
|
|
});
|
|
});
|
|
});
|
|
|
|
function setupMocks() {
|
|
const mocks = getMountOptions({
|
|
router: {
|
|
navigate: jest.fn(),
|
|
},
|
|
});
|
|
|
|
const mockVinComponent = {
|
|
mixins: [vinPagesMixin],
|
|
};
|
|
|
|
const wrapper = shallowMount(mockVinComponent, mocks);
|
|
|
|
return { wrapper };
|
|
}
|