refactor:项目架构重构和命名规范化
- 统一文件命名为snake_case格式(kebab-case snake_case) - 重构zulip模块为zulip_core,明确Core层职责 - 重构user-mgmt模块为user_mgmt,统一命名规范 - 调整模块依赖关系,优化架构分层 - 删除过时的文件和目录结构 - 更新相关文档和配置文件 本次重构涉及大量文件重命名和模块重组, 旨在建立更清晰的项目架构和统一的命名规范。
This commit is contained in:
@@ -9,9 +9,18 @@
|
||||
* - 错误处理
|
||||
* - 验证码统计信息
|
||||
*
|
||||
* 职责分离:
|
||||
* - 单元测试覆盖所有公共方法
|
||||
* - Mock依赖服务进行隔离测试
|
||||
* - 边界条件和异常情况测试
|
||||
*
|
||||
* 最近修改:
|
||||
* - 2026-01-07: 代码规范优化 - 完善文件头注释和修改记录规范
|
||||
*
|
||||
* @author moyin
|
||||
* @version 1.0.0
|
||||
* @version 1.0.1
|
||||
* @since 2025-12-17
|
||||
* @lastModified 2026-01-07
|
||||
*/
|
||||
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
@@ -71,11 +80,6 @@ describe('VerificationService', () => {
|
||||
});
|
||||
|
||||
it('应该使用默认Redis配置', () => {
|
||||
// 创建新的 mock ConfigService 来测试默认配置
|
||||
const testConfigService = {
|
||||
get: jest.fn((key: string, defaultValue?: any) => defaultValue),
|
||||
};
|
||||
|
||||
// 创建 mock Redis 服务
|
||||
const mockRedisService = {
|
||||
set: jest.fn(),
|
||||
@@ -87,26 +91,13 @@ describe('VerificationService', () => {
|
||||
flushall: jest.fn(),
|
||||
};
|
||||
|
||||
new VerificationService(testConfigService as any, mockRedisService as any);
|
||||
new VerificationService(mockRedisService as any);
|
||||
|
||||
// 由于现在使用注入的Redis服务,不再直接创建Redis实例
|
||||
expect(true).toBe(true);
|
||||
});
|
||||
|
||||
it('应该使用自定义Redis配置', () => {
|
||||
// 创建新的 mock ConfigService 来测试自定义配置
|
||||
const testConfigService = {
|
||||
get: jest.fn((key: string, defaultValue?: any) => {
|
||||
const config: Record<string, any> = {
|
||||
'REDIS_HOST': 'redis.example.com',
|
||||
'REDIS_PORT': 6380,
|
||||
'REDIS_PASSWORD': 'password123',
|
||||
'REDIS_DB': 1,
|
||||
};
|
||||
return config[key] !== undefined ? config[key] : defaultValue;
|
||||
}),
|
||||
};
|
||||
|
||||
// 创建 mock Redis 服务
|
||||
const mockRedisService = {
|
||||
set: jest.fn(),
|
||||
@@ -118,7 +109,7 @@ describe('VerificationService', () => {
|
||||
flushall: jest.fn(),
|
||||
};
|
||||
|
||||
new VerificationService(testConfigService as any, mockRedisService as any);
|
||||
new VerificationService(mockRedisService as any);
|
||||
|
||||
// 由于现在使用注入的Redis服务,不再直接创建Redis实例
|
||||
expect(true).toBe(true);
|
||||
|
||||
Reference in New Issue
Block a user