Convert all store files from JavaScript to TypeScript
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,7 @@ vi.mock('@/module/apiError.js', () => ({
|
||||
}));
|
||||
|
||||
import Login from '@/views/Login/Login.vue';
|
||||
import { useLoginStore } from '@/stores/login.ts';
|
||||
import { useLoginStore } from '@/stores/login';
|
||||
|
||||
describe('Login', () => {
|
||||
let pinia;
|
||||
|
||||
@@ -2,7 +2,7 @@ import { describe, it, expect, beforeEach, vi } from 'vitest';
|
||||
import { mount } from '@vue/test-utils';
|
||||
import { setActivePinia, createPinia } from 'pinia';
|
||||
import ModalHeader from '@/views/AccountManagement/ModalHeader.vue';
|
||||
import { useModalStore } from '@/stores/modal.js';
|
||||
import { useModalStore } from '@/stores/modal';
|
||||
|
||||
describe('ModalHeader', () => {
|
||||
let pinia;
|
||||
|
||||
@@ -13,7 +13,7 @@ vi.mock('@/api/client.js', () => ({
|
||||
}));
|
||||
|
||||
// Mock login store to avoid its side effects
|
||||
vi.mock('@/stores/login.ts', () => {
|
||||
vi.mock('@/stores/login', () => {
|
||||
const { defineStore } = require('pinia');
|
||||
return {
|
||||
useLoginStore: defineStore('loginStore', {
|
||||
@@ -27,7 +27,7 @@ vi.mock('@/stores/login.ts', () => {
|
||||
};
|
||||
});
|
||||
|
||||
import { useAcctMgmtStore } from '@/stores/acctMgmt.ts';
|
||||
import { useAcctMgmtStore } from '@/stores/acctMgmt';
|
||||
|
||||
describe('acctMgmtStore', () => {
|
||||
let store;
|
||||
|
||||
@@ -12,7 +12,7 @@ vi.mock('@/api/client.js', () => ({
|
||||
default: { get: mockGet, post: mockPost, put: mockPut },
|
||||
}));
|
||||
|
||||
import { useAllMapDataStore } from '@/stores/allMapData.js';
|
||||
import { useAllMapDataStore } from '@/stores/allMapData';
|
||||
|
||||
describe('allMapDataStore', () => {
|
||||
let store;
|
||||
|
||||
@@ -10,7 +10,7 @@ vi.mock('@/api/client.js', () => ({
|
||||
default: { get: mockGet },
|
||||
}));
|
||||
|
||||
import { useCompareStore } from '@/stores/compare.js';
|
||||
import { useCompareStore } from '@/stores/compare';
|
||||
|
||||
describe('compareStore', () => {
|
||||
let store;
|
||||
|
||||
@@ -13,7 +13,7 @@ vi.mock('@/api/client.js', () => ({
|
||||
}));
|
||||
|
||||
import apiError from '@/module/apiError.js';
|
||||
import { useConformanceStore } from '@/stores/conformance.js';
|
||||
import { useConformanceStore } from '@/stores/conformance';
|
||||
|
||||
describe('conformanceStore', () => {
|
||||
let store;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect, beforeEach } from 'vitest';
|
||||
import { setActivePinia, createPinia } from 'pinia';
|
||||
import { useConformanceInputStore } from '@/stores/conformanceInput.js';
|
||||
import { useConformanceInputStore } from '@/stores/conformanceInput';
|
||||
|
||||
describe('conformanceInputStore', () => {
|
||||
let store;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
||||
import { setActivePinia, createPinia } from 'pinia';
|
||||
import { useCytoscapeStore } from '@/stores/cytoscapeStore.ts';
|
||||
import { useCytoscapeStore } from '@/stores/cytoscapeStore';
|
||||
import { SAVE_KEY_NAME } from '@/constants/constants.js';
|
||||
|
||||
// Mock localStorage since jsdom's localStorage is limited
|
||||
|
||||
@@ -28,7 +28,7 @@ vi.mock('@/api/client.js', () => ({
|
||||
default: { get: mockGet, post: mockPost, put: mockPut, delete: mockDelete },
|
||||
}));
|
||||
|
||||
import { useFilesStore } from '@/stores/files.js';
|
||||
import { useFilesStore } from '@/stores/files';
|
||||
|
||||
describe('filesStore', () => {
|
||||
let store;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect, beforeEach } from 'vitest';
|
||||
import { setActivePinia, createPinia } from 'pinia';
|
||||
import { useLoadingStore } from '@/stores/loading.js';
|
||||
import { useLoadingStore } from '@/stores/loading';
|
||||
|
||||
describe('loadingStore', () => {
|
||||
let store;
|
||||
|
||||
@@ -13,7 +13,7 @@ vi.mock('@/api/client.js', () => ({
|
||||
default: { get: mockClientGet },
|
||||
}));
|
||||
|
||||
import { useLoginStore } from '@/stores/login.ts';
|
||||
import { useLoginStore } from '@/stores/login';
|
||||
|
||||
// Mock axios methods (used for signIn/refreshToken which call plain axios)
|
||||
vi.spyOn(axios, 'post').mockImplementation(vi.fn());
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect, beforeEach } from 'vitest';
|
||||
import { setActivePinia, createPinia } from 'pinia';
|
||||
import { useMapCompareStore } from '@/stores/mapCompareStore.ts';
|
||||
import { useMapCompareStore } from '@/stores/mapCompareStore';
|
||||
|
||||
describe('mapCompareStore', () => {
|
||||
let store;
|
||||
|
||||
@@ -2,7 +2,7 @@ import { describe, it, expect, beforeEach, vi } from 'vitest';
|
||||
import { setActivePinia, createPinia } from 'pinia';
|
||||
|
||||
// Mock allMapData store (used by createInsightWithPath / createPaths)
|
||||
vi.mock('@/stores/allMapData.js', () => ({
|
||||
vi.mock('@/stores/allMapData', () => ({
|
||||
default: () => ({ insights: {} }),
|
||||
}));
|
||||
|
||||
@@ -16,7 +16,7 @@ vi.mock('@/assets/capsule2.svg', () => ({ default: 'cap2' }));
|
||||
vi.mock('@/assets/capsule3.svg', () => ({ default: 'cap3' }));
|
||||
vi.mock('@/assets/capsule4.svg', () => ({ default: 'cap4' }));
|
||||
|
||||
import { useMapPathStore } from '@/stores/mapPathStore.ts';
|
||||
import { useMapPathStore } from '@/stores/mapPathStore';
|
||||
|
||||
/**
|
||||
* Creates a mock Cytoscape node.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect, beforeEach } from 'vitest';
|
||||
import { setActivePinia, createPinia } from 'pinia';
|
||||
import { useModalStore } from '@/stores/modal.js';
|
||||
import { useModalStore } from '@/stores/modal';
|
||||
import { MODAL_ACCT_INFO, MODAL_DELETE } from '@/constants/constants.js';
|
||||
|
||||
describe('modalStore', () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect, beforeEach } from 'vitest';
|
||||
import { setActivePinia, createPinia } from 'pinia';
|
||||
import { usePageAdminStore } from '@/stores/pageAdmin.js';
|
||||
import { usePageAdminStore } from '@/stores/pageAdmin';
|
||||
|
||||
describe('pageAdminStore', () => {
|
||||
let store;
|
||||
|
||||
@@ -10,7 +10,7 @@ vi.mock('@/api/client.js', () => ({
|
||||
default: { get: mockGet },
|
||||
}));
|
||||
|
||||
import { usePerformanceStore } from '@/stores/performance.js';
|
||||
import { usePerformanceStore } from '@/stores/performance';
|
||||
|
||||
describe('performanceStore', () => {
|
||||
let store;
|
||||
|
||||
@@ -2,16 +2,16 @@ import { describe, it, expect, beforeEach, vi } from 'vitest';
|
||||
import { setActivePinia, createPinia } from 'pinia';
|
||||
|
||||
// Mock all heavy imports that MainContainer.vue pulls in
|
||||
vi.mock('@/stores/loading.js', () => ({
|
||||
vi.mock('@/stores/loading', () => ({
|
||||
useLoadingStore: () => ({ isLoading: false }),
|
||||
}));
|
||||
vi.mock('@/stores/allMapData.js', () => ({
|
||||
vi.mock('@/stores/allMapData', () => ({
|
||||
useAllMapDataStore: () => ({}),
|
||||
}));
|
||||
vi.mock('@/stores/conformance.js', () => ({
|
||||
vi.mock('@/stores/conformance', () => ({
|
||||
useConformanceStore: () => ({}),
|
||||
}));
|
||||
vi.mock('@/stores/pageAdmin.js', () => ({
|
||||
vi.mock('@/stores/pageAdmin', () => ({
|
||||
usePageAdminStore: () => ({}),
|
||||
}));
|
||||
vi.mock('@/module/alertModal.js', () => ({
|
||||
@@ -26,7 +26,7 @@ vi.mock('@/router/index.ts', () => ({
|
||||
}));
|
||||
vi.mock('@/module/cytoscapeMap.js', () => ({}));
|
||||
|
||||
import { useLoginStore } from '@/stores/login.ts';
|
||||
import { useLoginStore } from '@/stores/login';
|
||||
import * as cookieUtil from '@/utils/cookieUtil.js';
|
||||
|
||||
// Import the component definition to access beforeRouteEnter
|
||||
|
||||
Reference in New Issue
Block a user