- Timestamp:
- 07/30/2026 11:48:53 AM (6 weeks ago)
- Branches:
- main
- Children:
- 1f640ff
- Parents:
- 67f7150
- File:
-
- 1 edited
-
test/c2s-compose.test.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
test/c2s-compose.test.js
r67f7150 r6dd26e5 102 102 }); 103 103 104 test("an audio note's waveform rides the tag, the store and the federated attachment", async () => { 105 // Same courtesy as the video poster (Robins vraag, 30-7: de kale 106 // audio-tegel): the upload leg draws <name>.poster.png (showwavespic). 107 // From there it must reach the data-poster on the folded tag (the tiles 108 // read it), the stored entry, and the AS2 icon on the federated Audio. 109 const os = await import('os'); 110 const fsm = await import('fs'); 111 const pathm = await import('path'); 112 const root = fsm.mkdtempSync(pathm.join(os.tmpdir(), 'klonkt-media-')); 113 fsm.mkdirSync(pathm.join(root, 'reply-media'), { recursive: true }); 114 fsm.writeFileSync(pathm.join(root, 'reply-media', 'lied.m4a.poster.png'), 'x'); 115 const prev = process.env.MEDIA_PATH; 116 process.env.MEDIA_PATH = root; 117 try { 118 const r = await AP.ingestOutboxActivity(site, user, { 119 type: 'Create', 120 object: { 121 type: 'Note', content: '', 122 to: ['https://test.example/ap/users/kid/followers'], 123 attachment: [{ type: 'Audio', url: '/media/reply-media/lied.m4a', mediaType: 'audio/mp4' }], 124 }, 125 }); 126 assert.equal(r.status, 201); 127 const post = db.prepare('SELECT * FROM posts WHERE id = ?').get(r.id); 128 assert.match(post.content, /data-poster="\/media\/reply-media\/lied\.m4a\.poster\.png"/, 'the tag carries the waveform for the tiles'); 129 const note = AP.buildNote('https://test.example', site, post); 130 const aud = (note.attachment || []).find((a) => a.url.endsWith('lied.m4a')); 131 assert.ok(aud && aud.type === 'Audio'); 132 assert.equal(aud.icon && aud.icon.url, 'https://test.example/media/reply-media/lied.m4a.poster.png', 133 'the waveform federates as the attachment icon'); 134 } finally { 135 if (prev === undefined) delete process.env.MEDIA_PATH; else process.env.MEDIA_PATH = prev; 136 } 137 }); 138 104 139 test('a video without a poster simply has none: no guessed icon', async () => { 105 140 const r = await AP.ingestOutboxActivity(site, user, {
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)