- Timestamp:
- 07/26/2026 08:20:58 AM (6 weeks ago)
- Branches:
- main
- Children:
- af6e085
- Parents:
- cc3cf7d
- File:
-
- 1 edited
-
test/object-links.test.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
test/object-links.test.js
rcc3cf7d r6fd0e20 6 6 const dbMod = await import('../src/config/database.js'); 7 7 dbMod.initializeDatabase(); 8 const { extractObjectLinkTags, timelineObjectLinks, extractQuoteUrl, extractLinkJson } = await import('../src/services/ActivityPubService.js');9 const AP = { extractObjectLinkTags, timelineObjectLinks, extractQuoteUrl, extractLinkJson };8 const { extractObjectLinkTags, timelineObjectLinks, extractQuoteUrl, extractLinkJson, quoteHrefOf, timelineQuote } = await import('../src/services/ActivityPubService.js'); 9 const AP = { extractObjectLinkTags, timelineObjectLinks, extractQuoteUrl, extractLinkJson, quoteHrefOf, timelineQuote }; 10 10 11 11 test('extractObjectLinkTags keeps AS2-profiled ld+json and activity+json Links; drops plain links and mentions', () => { … … 59 59 assert.equal(arr[0].href, 'https://s/objects/9'); 60 60 }); 61 62 // FEP-044f embedded quote card: the quoted-post URL feeds the resolver. 63 test('quoteHrefOf reads an object-level quote or a quote-rel FEP-e232 Link', () => { 64 assert.equal(AP.quoteHrefOf({ quoteUrl: 'https://s/q1' }), 'https://s/q1'); 65 assert.equal(AP.quoteHrefOf({ 66 tag: [{ type: 'Link', href: 'https://s/q2', rel: 'https://misskey-hub.net/ns#_misskey_quote' }], 67 }), 'https://s/q2'); 68 assert.equal(AP.quoteHrefOf({ content: 'plain, no quote' }), null); 69 // a plain (non-quote) FEP-e232 reference is not a quote target 70 assert.equal(AP.quoteHrefOf({ tag: [{ type: 'Link', href: 'https://s/ref', rel: 'mention' }] }), null); 71 }); 72 73 test('timelineQuote round-trips the stored snapshot; junk → undefined', () => { 74 const snap = JSON.stringify({ url: 'https://s/q', author: { name: 'A', handle: '@a@s', icon: null }, content: '<p>hi</p>' }); 75 const back = AP.timelineQuote(snap); 76 assert.equal(back.url, 'https://s/q'); 77 assert.equal(back.author.handle, '@a@s'); 78 assert.equal(AP.timelineQuote(null), undefined); 79 assert.equal(AP.timelineQuote('not json'), undefined); 80 });
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)