Convert all store files from JavaScript to TypeScript

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 14:47:57 +08:00
parent 90048d0505
commit a619be7881
65 changed files with 2031 additions and 5066 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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

View File

@@ -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;

View File

@@ -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;

View File

@@ -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());

View File

@@ -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;

View File

@@ -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.

View File

@@ -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', () => {

View File

@@ -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;

View File

@@ -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;