forked from mirror/misskey
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) :
|
await resolver.resolveOrderedCollectionPage(collection.first) :
|
||||||
collection;
|
collection;
|
||||||
|
|
||||||
// Perform activity but only the first 15 ones
|
// Perform activity but only the first 20 ones
|
||||||
await this.apInboxService.performActivity(user, firstPage, 15);
|
await this.apInboxService.performActivity(user, firstPage, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@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, {
|
this._rs.set(uri, {
|
||||||
type,
|
type,
|
||||||
content: typeof content === 'string' ? content : JSON.stringify(content),
|
content: typeof content === 'string' ? content : JSON.stringify(content),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public clear() {
|
||||||
|
this._rs.clear();
|
||||||
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public async resolve(value: string | IObject): Promise<IObject> {
|
public async resolve(value: string | IObject): Promise<IObject> {
|
||||||
if (typeof value !== 'string') return value;
|
if (typeof value !== 'string') return value;
|
||||||
|
@ -91,7 +91,7 @@ describe('ActivityPub', () => {
|
|||||||
let rendererService: ApRendererService;
|
let rendererService: ApRendererService;
|
||||||
let resolver: MockResolver;
|
let resolver: MockResolver;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeAll(async () => {
|
||||||
const app = await Test.createTestingModule({
|
const app = await Test.createTestingModule({
|
||||||
imports: [GlobalModule, CoreModule],
|
imports: [GlobalModule, CoreModule],
|
||||||
}).compile();
|
}).compile();
|
||||||
@ -109,6 +109,10 @@ describe('ActivityPub', () => {
|
|||||||
jest.spyOn(federatedInstanceService, 'fetch').mockImplementation(() => new Promise(() => { }));
|
jest.spyOn(federatedInstanceService, 'fetch').mockImplementation(() => new Promise(() => { }));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
resolver.clear();
|
||||||
|
});
|
||||||
|
|
||||||
describe('Parse minimum object', () => {
|
describe('Parse minimum object', () => {
|
||||||
const actor = createRandomActor();
|
const actor = createRandomActor();
|
||||||
|
|
||||||
@ -227,8 +231,8 @@ describe('ActivityPub', () => {
|
|||||||
await personService.createPerson(actor.id, resolver);
|
await personService.createPerson(actor.id, resolver);
|
||||||
|
|
||||||
const items = outbox.orderedItems as ICreate[];
|
const items = outbox.orderedItems as ICreate[];
|
||||||
assert.ok(await noteService.fetchNote(items[99].object));
|
assert.ok(await noteService.fetchNote(items[19].object));
|
||||||
assert.ok(!await noteService.fetchNote(items[100].object));
|
assert.ok(!await noteService.fetchNote(items[20].object));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user