import { shallowMount } from "@vue/test-utils";
import progressBar from "./progress-bar";
import store from "@/store";

describe("progressBar", () => {
    test("progress should be 0", () => {
        // Arrange

        // Act
        const wrapper = shallowMount(progressBar, {
            mixins: [mockMixin],
        });

        // Assert
        expect(wrapper.vm.progress).toBe(0);
        wrapper.unmount();
    });
});

describe("progressBar", () => {
    test("progress should be 4%", () => {
        // Arrange
        store.getters = {
            applicationUser: {
                lastPageVisited: "vehicle",
            },
        };

        // Act
        const wrapper = shallowMount(progressBar, {
            mixins: [mockMixin],
        });

        // Assert
        expect(wrapper.vm.progress).toBe(4);
        wrapper.unmount();
    });
});

describe("progressBar", () => {
    test("progress should be 48%", () => {
        // Arrange
        store.getters = {
            applicationUser: {
                lastPageVisited: "quote",
            },
        };

        // Act
        const wrapper = shallowMount(progressBar, {
            mixins: [mockMixin],
        });

        // Assert
        expect(wrapper.vm.progress).toBe(48);
        wrapper.unmount();
    });
});

describe("progressBar", () => {
    test("progress should be 100%", () => {
        // Arrange
        store.getters = {
            applicationUser: {
                lastPageVisited: "confirmation",
            },
        };

        // Act
        const wrapper = shallowMount(progressBar, {
            mixins: [mockMixin],
        });

        // Assert
        expect(wrapper.vm.progress).toBe(100);
        wrapper.unmount();
    });
});

const mockMixin = {
    methods: {
        getProgress: jest.fn(),
    },
};
