remove NoOpCaches in favor of CacheManagementService

This commit is contained in:
Hazelnoot 2025-10-01 11:48:56 -04:00
parent c8976fef94
commit 3f950e398b
10 changed files with 240 additions and 554 deletions

View file

@ -11,8 +11,10 @@ import { FollowingsRepository, InstancesRepository, MiUser, UserProfilesReposito
import { IdService } from '@/core/IdService.js';
import { GlobalModule } from '@/GlobalModule.js';
import { DI } from '@/di-symbols.js';
import { CacheManagementService } from '@/core/CacheManagementService.js';
import { UserEntityService } from '@/core/entities/UserEntityService.js';
import { genAidx } from '@/misc/id/aidx.js';
import { CoreModule } from '@/core/CoreModule.js';
describe('UserSearchService', () => {
let app: TestingModule;
@ -22,6 +24,7 @@ describe('UserSearchService', () => {
let usersRepository: UsersRepository;
let followingsRepository: FollowingsRepository;
let idService: IdService;
let cacheManagementService: CacheManagementService;
let userProfilesRepository: UserProfilesRepository;
let root: MiUser;
@ -103,17 +106,12 @@ describe('UserSearchService', () => {
.createTestingModule({
imports: [
GlobalModule,
CoreModule,
],
providers: [
UserSearchService,
{
provide: UserEntityService, useFactory: jest.fn(() => ({
// とりあえずIDが返れば確認が出来るので
packMany: (value: any) => value,
})),
},
IdService,
],
})
.overrideProvider(UserEntityService).useValue({
// とりあえずIDが返れば確認が出来るので
packMany: (value: any) => value,
})
.compile();
@ -127,6 +125,7 @@ describe('UserSearchService', () => {
service = app.get(UserSearchService);
idService = app.get(IdService);
cacheManagementService = app.get(CacheManagementService);
});
beforeEach(async () => {
@ -145,6 +144,7 @@ describe('UserSearchService', () => {
afterEach(async () => {
await usersRepository.delete({});
cacheManagementService.clear();
});
afterAll(async () => {