test(backend): update tests

This commit is contained in:
Daiki Mizukami 2024-08-10 07:09:50 +09:00
parent 699cbd0d77
commit 8b7ae92b78
No known key found for this signature in database
GPG Key ID: 10478E598B944AA2

View File

@ -210,7 +210,7 @@ describe('ActivityPub', () => {
}); });
describe('Collection visibility', () => { describe('Collection visibility', () => {
test('Public following/followers', async () => { test('Public following/followers/reactions', async () => {
const actor = createRandomActor(); const actor = createRandomActor();
actor.following = { actor.following = {
id: `${actor.id}/following`, id: `${actor.id}/following`,
@ -219,6 +219,12 @@ describe('ActivityPub', () => {
first: `${actor.id}/following?page=1`, first: `${actor.id}/following?page=1`,
}; };
actor.followers = `${actor.id}/followers`; actor.followers = `${actor.id}/followers`;
actor.liked ={
id: `${actor.id}/following`,
type: 'OrderedCollection',
totalItems: 0,
orderedItems: [],
};
resolver.register(actor.id, actor); resolver.register(actor.id, actor);
resolver.register(actor.followers, { resolver.register(actor.followers, {
@ -233,9 +239,10 @@ describe('ActivityPub', () => {
assert.deepStrictEqual(userProfile.followingVisibility, 'public'); assert.deepStrictEqual(userProfile.followingVisibility, 'public');
assert.deepStrictEqual(userProfile.followersVisibility, 'public'); assert.deepStrictEqual(userProfile.followersVisibility, 'public');
assert.deepStrictEqual(userProfile.publicReactions, true);
}); });
test('Private following/followers', async () => { test('Private following/followers/reactions', async () => {
const actor = createRandomActor(); const actor = createRandomActor();
actor.following = { actor.following = {
id: `${actor.id}/following`, id: `${actor.id}/following`,
@ -244,6 +251,7 @@ describe('ActivityPub', () => {
// first: … // first: …
}; };
actor.followers = `${actor.id}/followers`; actor.followers = `${actor.id}/followers`;
// actor.liked = …;
resolver.register(actor.id, actor); resolver.register(actor.id, actor);
//resolver.register(actor.followers, { … }); //resolver.register(actor.followers, { … });
@ -253,6 +261,7 @@ describe('ActivityPub', () => {
assert.deepStrictEqual(userProfile.followingVisibility, 'private'); assert.deepStrictEqual(userProfile.followingVisibility, 'private');
assert.deepStrictEqual(userProfile.followersVisibility, 'private'); assert.deepStrictEqual(userProfile.followersVisibility, 'private');
assert.deepStrictEqual(userProfile.publicReactions, false);
}); });
}); });