Changeset b1512e0 in Klonkt for test/embed-resolver.test.js
- Timestamp:
- 07/28/2026 08:54:20 AM (6 weeks ago)
- Branches:
- main
- Children:
- bdb78e4
- Parents:
- 3f32994
- File:
-
- 1 edited
-
test/embed-resolver.test.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
test/embed-resolver.test.js
r3f32994 rb1512e0 182 182 assert.ok(page && page.includes('og:image'), 'the head survives the cap'); 183 183 }); 184 185 // Regression: big sites carry the bare string "og:image" inside inline JSON long 186 // before the real meta tag. Stopping the read there cut the page off just short 187 // of the tags and produced no card at all. 188 test('the head read does not stop on an og:image mention inside a script', async () => { 189 const { liveIO } = await import('../src/services/EmbedResolver.js'); 190 const page = '<html><head><script>var cfg={"og:image":"decoy"};</script>' 191 + 'y'.repeat(3000) 192 + '<meta property="og:title" content="Echt"><meta property="og:image" content="https://x/real.png">' 193 + '</head></html>'; 194 const fakeFetch = async () => ({ ok: true, headers: { get: () => '999' }, text: async () => page }); 195 const io = liveIO({ safeFetch: fakeFetch, detectProvider: () => null }); 196 const got = await io.getPage('https://x/p'); 197 const { findOpenGraph } = await import('../src/services/EmbedResolver.js'); 198 assert.equal(findOpenGraph(got).image, 'https://x/real.png', 'reads past the decoy to the real tag'); 199 });
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)