Add store tests with mocked axios and apiError
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
31
tests/stores/mapCompareStore.test.js
Normal file
31
tests/stores/mapCompareStore.test.js
Normal file
@@ -0,0 +1,31 @@
|
||||
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',
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user