test(pokedex): cover shared dex loading and preview badges

Adds loadSharedPokedex unit tests and a share preview case for every badge, restoring the branch coverage gate. Gives the offline sync BDD poll 30s so a full Living Dex snapshot can finish caching on CI.
This commit is contained in:
Josh Creek
2026-09-14 14:47:27 +01:00
parent 27274171fe
commit ca7f9c0e48
3 changed files with 122 additions and 11 deletions
+16
View File
@@ -42,6 +42,22 @@ describe('share preview rendering', () => {
expect(svg).toContain('42%');
});
it('lists every enabled dex badge and omits an empty description', () => {
const svg = buildSharePreviewSvg({
...shared,
description: '',
isShinyDex: true,
isOriginDex: true,
isFormDex: true,
gameScope: 'Scarlet'
});
for (const badge of ['Living', 'Shiny', 'Origin', 'Form', 'Scarlet']) {
expect(svg).toContain(`class="badge">${badge}</text>`);
}
expect(svg).not.toContain('All Games');
expect(svg).not.toContain('class="description"');
});
it('renders a valid 1200 by 630 PNG', async () => {
const png = await renderSharePreview(shared);
const metadata = await sharp(png).metadata();