19 lines
578 B
JavaScript
19 lines
578 B
JavaScript
import { mount } from "@vue/test-utils";
|
|
// import axios from "axios";
|
|
import store from "@/store/index.js";
|
|
import Fruits from "@/views/Fruits.vue";
|
|
|
|
// jest.mock("axios", () => ({
|
|
// get: jest.fn(() => Promise.resolve({ data: {} }))
|
|
// }));
|
|
|
|
describe("Test Fruits page.", () => {
|
|
it("dispatches getFruits on mounted", async () => {
|
|
// axios.get.mockImplementationOnce(() => Promise.resolve({ data: { data: "value" } }));
|
|
const wrapper = mount(Fruits, { store });
|
|
|
|
await store.dispatch("getFruits");
|
|
expect(store.state.fruits.fruitCount).toBe(6);
|
|
});
|
|
});
|