adjust tests
This commit is contained in:
parent
7bf318ae98
commit
6087d02047
|
@ -642,8 +642,8 @@ export class ApPersonService implements OnModuleInit {
|
|||
await resolver.resolveOrderedCollectionPage(collection.first) :
|
||||
collection;
|
||||
|
||||
// Perform activity but only the first 15 ones
|
||||
await this.apInboxService.performActivity(user, firstPage, 15);
|
||||
// Perform activity but only the first 20 ones
|
||||
await this.apInboxService.performActivity(user, firstPage, 20);
|
||||
}
|
||||
|
||||
@bindThis
|
||||
|
|
|
@ -38,13 +38,17 @@ export class MockResolver extends Resolver {
|
|||
);
|
||||
}
|
||||
|
||||
public async _register(uri: string, content: string | Record<string, any>, type = 'application/activity+json') {
|
||||
public _register(uri: string, content: string | Record<string, any>, type = 'application/activity+json') {
|
||||
this._rs.set(uri, {
|
||||
type,
|
||||
content: typeof content === 'string' ? content : JSON.stringify(content),
|
||||
});
|
||||
}
|
||||
|
||||
public clear() {
|
||||
this._rs.clear();
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async resolve(value: string | IObject): Promise<IObject> {
|
||||
if (typeof value !== 'string') return value;
|
||||
|
|
|
@ -91,7 +91,7 @@ describe('ActivityPub', () => {
|
|||
let rendererService: ApRendererService;
|
||||
let resolver: MockResolver;
|
||||
|
||||
beforeEach(async () => {
|
||||
beforeAll(async () => {
|
||||
const app = await Test.createTestingModule({
|
||||
imports: [GlobalModule, CoreModule],
|
||||
}).compile();
|
||||
|
@ -109,6 +109,10 @@ describe('ActivityPub', () => {
|
|||
jest.spyOn(federatedInstanceService, 'fetch').mockImplementation(() => new Promise(() => { }));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
resolver.clear();
|
||||
});
|
||||
|
||||
describe('Parse minimum object', () => {
|
||||
const actor = createRandomActor();
|
||||
|
||||
|
@ -227,8 +231,8 @@ describe('ActivityPub', () => {
|
|||
await personService.createPerson(actor.id, resolver);
|
||||
|
||||
const items = outbox.orderedItems as ICreate[];
|
||||
assert.ok(await noteService.fetchNote(items[99].object));
|
||||
assert.ok(!await noteService.fetchNote(items[100].object));
|
||||
assert.ok(await noteService.fetchNote(items[19].object));
|
||||
assert.ok(!await noteService.fetchNote(items[20].object));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue