Skip to content

Commit

Permalink
wip: add test
Browse files Browse the repository at this point in the history
  • Loading branch information
GrapeApple0 committed Jul 23, 2024
1 parent 9bb6ce4 commit 0522520
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/backend/src/core/activitypub/ApRendererService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ export class ApRendererService {
}

@bindThis
public renderNoteUpdate(object: IObject, note: MiNote, user: { id: MiUser['id'] }): IUpdate {
public renderNoteUpdate(object: IPost, note: MiNote, user: { id: MiUser['id'] }): IUpdate {
const activity: IUpdate = {
id: `${this.config.url}/users/${user.id}#updates/${new Date().getTime()}`,
actor: this.userEntityService.genLocalUserUri(note.userId),
Expand Down
19 changes: 19 additions & 0 deletions packages/backend/test/unit/activitypub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,25 @@ describe('ActivityPub', () => {
});
});

describe('Update', async () => {
const actor = createRandomActor();

const post = {
'@context': 'https://www.w3.org/ns/activitystreams',
id: `${host}/users/${secureRndstr(8)}`,
type: 'Note',
attributedTo: actor.id,
to: 'https://www.w3.org/ns/activitystreams#Public',
content: 'あ',
};

const note = await noteService.createNote(post.id, resolver, true);

test('Update note', async () => {
rendererService.renderNoteUpdate(await rendererService.renderNote(note!, false, true), note!, actor);
});
});

describe('JSON-LD', () =>{
test('Compaction', async () => {
const jsonLd = jsonLdService.use();
Expand Down

0 comments on commit 0522520

Please sign in to comment.