37 lines
880 B
JavaScript
37 lines
880 B
JavaScript
import mutations from "@/store/mutations.js";
|
|
|
|
describe("Test Vuex mutations.", () => {
|
|
it("should add fruits to the state", () => {
|
|
const fruits = [
|
|
{
|
|
id: 3,
|
|
isFruit: true,
|
|
name: "banana",
|
|
image: "/image/path.jpg",
|
|
price: "907.00",
|
|
color: "#763e44",
|
|
description: "Iusto illum vero voluptatem.",
|
|
taste: "Handcrafted",
|
|
expires: "2021-04-11T08:54:24.588Z"
|
|
}
|
|
];
|
|
const state = {
|
|
fruits: []
|
|
};
|
|
mutations.setFruits(state, fruits);
|
|
expect(state.fruits).toEqual([
|
|
{
|
|
id: 3,
|
|
isFruit: true,
|
|
name: "banana",
|
|
image: "/image/path.jpg",
|
|
price: "907.00",
|
|
color: "#763e44",
|
|
description: "Iusto illum vero voluptatem.",
|
|
taste: "Handcrafted",
|
|
expires: "2021-04-11T08:54:24.588Z"
|
|
}
|
|
]);
|
|
});
|
|
});
|