32 lines
782 B
JavaScript
32 lines
782 B
JavaScript
import { describe, it, expect, beforeEach } from 'vitest';
|
|
import { setActivePinia, createPinia } from 'pinia';
|
|
import useMapCompareStore from '@/stores/mapCompareStore.ts';
|
|
|
|
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',
|
|
});
|
|
});
|
|
});
|