feat(image): 新建 knowai-core:1.0.0 镜像并完成推送
Some checks reported errors
continuous-integration/drone/push Build was killed
Some checks reported errors
continuous-integration/drone/push Build was killed
- 搭建 api、auth、utils 等逻辑模块 - 通过 tsc、eslint、vitest 测试验证 BREAKING CHANGE: 新镜像分支
This commit is contained in:
23
test/mocks/storage.ts
Normal file
23
test/mocks/storage.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* 测试用的模拟存储适配器
|
||||
*/
|
||||
|
||||
import { vi } from 'vitest';
|
||||
import type { StorageAdapter } from '@/auth/storage-adapter';
|
||||
|
||||
/**
|
||||
* 创建模拟的存储适配器
|
||||
* @returns 模拟的存储适配器实例
|
||||
*/
|
||||
export const createMockStorage = (): StorageAdapter => {
|
||||
const storage: Record<string, string> = {};
|
||||
return {
|
||||
getItem: vi.fn((key: string) => storage[key] || null),
|
||||
setItem: vi.fn((key: string, value: string) => {
|
||||
storage[key] = value;
|
||||
}),
|
||||
removeItem: vi.fn((key: string) => {
|
||||
delete storage[key];
|
||||
})
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user