690525:1320 ADR-028-228-migration #06
This commit is contained in:
@@ -6,6 +6,7 @@ import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { getRepositoryToken } from '@nestjs/typeorm';
|
||||
import { AiSettingsService } from './ai-settings.service';
|
||||
import { SystemSetting } from './entities/system-setting.entity';
|
||||
import { AiAvailableModel } from './entities/ai-available-model.entity';
|
||||
|
||||
const DEFAULT_REDIS_TOKEN = 'default_IORedisModuleConnectionToken';
|
||||
|
||||
@@ -18,6 +19,15 @@ describe('AiSettingsService', () => {
|
||||
},
|
||||
};
|
||||
|
||||
const mockAiModelRepo = {
|
||||
find: jest.fn(),
|
||||
findOne: jest.fn(),
|
||||
save: jest.fn(),
|
||||
create: jest.fn(),
|
||||
update: jest.fn(),
|
||||
softDelete: jest.fn(),
|
||||
};
|
||||
|
||||
const mockRedis = {
|
||||
get: jest.fn(),
|
||||
set: jest.fn(),
|
||||
@@ -35,6 +45,10 @@ describe('AiSettingsService', () => {
|
||||
provide: getRepositoryToken(SystemSetting),
|
||||
useValue: mockSettingRepo,
|
||||
},
|
||||
{
|
||||
provide: getRepositoryToken(AiAvailableModel),
|
||||
useValue: mockAiModelRepo,
|
||||
},
|
||||
{ provide: DEFAULT_REDIS_TOKEN, useValue: mockRedis },
|
||||
],
|
||||
}).compile();
|
||||
|
||||
Reference in New Issue
Block a user