fix test
This commit is contained in:
parent
f3e3e0adb5
commit
5a4fc6e135
|
@ -7,6 +7,7 @@ import { GlobalModule } from '@/GlobalModule.js';
|
|||
import { RelayService } from '@/core/RelayService.js';
|
||||
import { ApRendererService } from '@/core/activitypub/ApRendererService.js';
|
||||
import { CreateSystemUserService } from '@/core/CreateSystemUserService.js';
|
||||
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||
import { QueueService } from '@/core/QueueService.js';
|
||||
import { IdService } from '@/core/IdService.js';
|
||||
import type { RelaysRepository } from '@/models/index.js';
|
||||
|
@ -21,6 +22,7 @@ describe('RelayService', () => {
|
|||
let relayService: RelayService;
|
||||
let queueService: jest.Mocked<QueueService>;
|
||||
let relaysRepository: RelaysRepository;
|
||||
let userEntityService: UserEntityService;
|
||||
|
||||
beforeAll(async () => {
|
||||
app = await Test.createTestingModule({
|
||||
|
@ -32,6 +34,7 @@ describe('RelayService', () => {
|
|||
CreateSystemUserService,
|
||||
ApRendererService,
|
||||
RelayService,
|
||||
UserEntityService,
|
||||
],
|
||||
})
|
||||
.useMocker((token) => {
|
||||
|
@ -51,6 +54,7 @@ describe('RelayService', () => {
|
|||
relayService = app.get<RelayService>(RelayService);
|
||||
queueService = app.get<QueueService>(QueueService) as jest.Mocked<QueueService>;
|
||||
relaysRepository = app.get<RelaysRepository>(DI.relaysRepository);
|
||||
userEntityService = app.get<UserEntityService>(UserEntityService);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
|
@ -63,7 +67,7 @@ describe('RelayService', () => {
|
|||
expect(result.inbox).toBe('https://example.com');
|
||||
expect(result.status).toBe('requesting');
|
||||
expect(queueService.deliver).toHaveBeenCalled();
|
||||
expect(queueService.deliver.mock.lastCall![1].type).toBe('Follow');
|
||||
expect(queueService.deliver.mock.lastCall![1]?.type).toBe('Follow');
|
||||
expect(queueService.deliver.mock.lastCall![2]).toBe('https://example.com');
|
||||
//expect(queueService.deliver.mock.lastCall![0].username).toBe('relay.actor');
|
||||
});
|
||||
|
@ -80,8 +84,8 @@ describe('RelayService', () => {
|
|||
await relayService.removeRelay('https://example.com');
|
||||
|
||||
expect(queueService.deliver).toHaveBeenCalled();
|
||||
expect(queueService.deliver.mock.lastCall![1].type).toBe('Undo');
|
||||
expect(queueService.deliver.mock.lastCall![1].object.type).toBe('Follow');
|
||||
expect(queueService.deliver.mock.lastCall![1]?.type).toBe('Undo');
|
||||
expect(queueService.deliver.mock.lastCall![1]?.object.type).toBe('Follow');
|
||||
expect(queueService.deliver.mock.lastCall![2]).toBe('https://example.com');
|
||||
//expect(queueService.deliver.mock.lastCall![0].username).toBe('relay.actor');
|
||||
|
||||
|
|
Loading…
Reference in New Issue