Files
lucia-frontend/tests/stores/mapCompareStore.test.js
2026-03-08 12:11:57 +08:00

37 lines
918 B
JavaScript

// The Lucia project.
// Copyright 2026-2026 DSP, inc. All rights reserved.
// Authors:
// imacat.yang@dsp.im (imacat), 2026/03/05
import { describe, it, expect, beforeEach } from "vitest";
import { setActivePinia, createPinia } from "pinia";
import { useMapCompareStore } from "@/stores/mapCompareStore";
describe("mapCompareStore", () => {
let store;
beforeEach(() => {
setActivePinia(createPinia());
store = useMapCompareStore();
});
it("has correct default state", () => {
expect(store.routeParam).toEqual({
primaryType: "",
primaryId: "",
secondaryType: "",
secondaryId: "",
});
});
it("setCompareRouteParam sets all params", () => {
store.setCompareRouteParam("log", "1", "filter", "2");
expect(store.routeParam).toEqual({
primaryType: "log",
primaryId: "1",
secondaryType: "filter",
secondaryId: "2",
});
});
});