fix: 修复 TypeScript 测试配置类型错误
修复内容: - 修复 IntersectionObserver mock 缺少必需属性的类型错误 - 修复 localStorage mock 缺少 length 和 key 属性的类型错误 - 添加正确的类型断言确保测试环境兼容性 构建准备: - 解决构建过程中的 TypeScript 编译错误 - 确保生产构建能够正常完成 - 为 release 0.1.1 做好准备
This commit is contained in:
parent
2f7ed4ae99
commit
7537342b43
|
|
@ -13,11 +13,16 @@ Object.defineProperty(window, '__TAURI__', {
|
|||
|
||||
// Mock IntersectionObserver
|
||||
global.IntersectionObserver = class IntersectionObserver {
|
||||
root = null;
|
||||
rootMargin = '';
|
||||
thresholds = [];
|
||||
|
||||
constructor() {}
|
||||
disconnect() {}
|
||||
observe() {}
|
||||
unobserve() {}
|
||||
};
|
||||
takeRecords() { return []; }
|
||||
} as any;
|
||||
|
||||
// Mock ResizeObserver
|
||||
global.ResizeObserver = class ResizeObserver {
|
||||
|
|
@ -44,9 +49,11 @@ Object.defineProperty(window, 'matchMedia', {
|
|||
|
||||
// Mock localStorage
|
||||
const localStorageMock = {
|
||||
length: 0,
|
||||
getItem: vi.fn(),
|
||||
setItem: vi.fn(),
|
||||
removeItem: vi.fn(),
|
||||
clear: vi.fn(),
|
||||
};
|
||||
key: vi.fn(),
|
||||
} as Storage;
|
||||
global.localStorage = localStorageMock;
|
||||
|
|
|
|||
Loading…
Reference in New Issue