Changeset c49808e in Klonkt for test/own-card.test.js
- Timestamp:
- 08/08/2026 11:04:29 PM (4 weeks ago)
- Branches:
- main
- Children:
- c72e45e
- Parents:
- cae7bfc
- git-author:
- Robin <roboburr@…> (08/08/2026 11:04:09 PM)
- git-committer:
- Robin <roboburr@…> (08/08/2026 11:04:29 PM)
- File:
-
- 1 edited
-
test/own-card.test.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
test/own-card.test.js
rcae7bfc rc49808e 88 88 assert.deepEqual(await AP.previewCard('geen url'), {}); 89 89 }); 90 91 92 test('actorInfo kiest de html-Link uit een url-array (geen object-stringing)', async () => { 93 // Barts vondst (8-8): buildActor serveert `url` als array van Links 94 // (profiel + RSS), en een consument die dat niet kent stringde de array tot 95 // "[object Object],[object Object]" in de mention-href van een HULPVRAAG. 96 // De thread-byline loopt door dezelfde actorInfo, dus die legt het vast. 97 const HOST = 'https://203.0.113.62'; 98 const NOTE = `${HOST}/notes/n1`; 99 const AUTEUR = `${HOST}/users/array`; 100 const vorige = globalThis.fetch; 101 globalThis.fetch = async (url) => { 102 const u = String(url); 103 const json = (o) => new Response(JSON.stringify(o), { status: 200, headers: { 'content-type': 'application/activity+json' } }); 104 if (u === NOTE) return json({ 105 id: NOTE, type: 'Note', attributedTo: AUTEUR, content: '<p>bron</p>', 106 replies: { type: 'Collection', first: { type: 'CollectionPage', items: [ 107 { id: `${NOTE}/r1`, type: 'Note', attributedTo: AUTEUR, inReplyTo: NOTE, content: '<p>antwoord</p>', published: '2026-08-02T10:00:00Z' }, 108 ] } }, 109 }); 110 if (u === AUTEUR) return json({ 111 id: AUTEUR, type: 'Person', preferredUsername: 'array', inbox: `${AUTEUR}/inbox`, 112 url: [ 113 { type: 'Link', href: `${HOST}/`, mediaType: 'text/html' }, 114 { type: 'Link', href: `${HOST}/feed.xml`, mediaType: 'application/rss+xml' }, 115 ], 116 }); 117 return vorige(url); 118 }; 119 const uit = await AP.getThread('schrijver', NOTE); 120 globalThis.fetch = vorige; 121 assert.equal(uit.notes.length, 1); 122 const auteur = uit.notes[0]['shaer:author']; 123 assert.equal(auteur.url, `${HOST}/`, 'de html-Link, niet de array gestringd'); 124 assert.ok(!String(auteur.url).includes('object'), 'nergens [object Object]'); 125 });
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)