Skip to content

Add Tests for DEFAULT_FONTS_BASE64 Coverage in SVG Generator - #8326

Open
ChetanSenta wants to merge 1 commit into
JhaSourav07:mainfrom
ChetanSenta:test/verify-default-fonts-base64-embedding
Open

Add Tests for DEFAULT_FONTS_BASE64 Coverage in SVG Generator#8326
ChetanSenta wants to merge 1 commit into
JhaSourav07:mainfrom
ChetanSenta:test/verify-default-fonts-base64-embedding

Conversation

@ChetanSenta

Copy link
Copy Markdown
Contributor

Description

Fixes #8325

Pillar

  • 🎨 Pillar 1 — New Theme Design
  • 📐 Pillar 2 — Geometric SVG Improvement
  • 🕐 Pillar 3 — Timezone Logic Optimization
  • 🛠️ Other (Bug fix, refactoring, docs)

Visual Preview

No visual change — pure test additions.

What this PR does

All 16 occurrences of process.env.NODE_ENV === 'test' ? <google-fonts-url> : DEFAULT_FONTS_BASE64
in lib/svg/generator.ts mean DEFAULT_FONTS_BASE64 (the real,
production font-embedding constant in lib/svg/fonts.ts) is never
actually rendered by any existing test, since Vitest sets
NODE_ENV=test. Added lib/svg/fonts.test.ts: direct structural checks
on the constant itself (bypassing the branch entirely), plus one test
that temporarily overrides NODE_ENV to confirm a real generator
function actually embeds the real font CSS in production.

Checklist before requesting a review:

  • I have read the CONTRIBUTING.md file.
  • I have tested these changes locally.
  • I have run npm run format and npm run lint locally and resolved all errors.
  • My commits follow the Conventional Commits format.
  • I have made sure that I have only one commit to merge in this PR.

… unreachable in every test due to NODE_ENV=test override
@retenta-bot

retenta-bot Bot commented Jul 25, 2026

Copy link
Copy Markdown

This pull request addresses the lack of test coverage for the DEFAULT_FONTS_BASE64 constant in the SVG generator. It introduces tests that directly check the constant and also validate the font embedding functionality in a production-like environment. This aligns with our previous decisions to enhance testing practices, such as adding unit tests for timezone normalization and implementing visual regression testing for SVG generators. Thank you for your contribution, and I look forward to your updates!

@retenta-bot retenta-bot Bot changed the title test(fonts): add coverage for DEFAULT_FONTS_BASE64 — the real production font-embed path was never exercised by any test Add Tests for DEFAULT_FONTS_BASE64 Coverage in SVG Generator Jul 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Size Report (Gzipped Sizes)

✨ No significant bundle size changes detected.

📊 Summary of Totals

Category PR Size Base Size Difference
Total JS 4052.50 KB 4052.50 KB 0 B
Total CSS 338.94 KB 338.94 KB 0 B

@Aamod007 Aamod007 added level:beginner Small changes Usually isolated fixes or simple UI/text updates. quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. mentor:Aamod007 type:testing Adding, updating, or fixing tests labels Jul 27, 2026

@Aamod007 Aamod007 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean test additions for font coverage in the SVG generator. CI pending — once green, good to merge.

Labels: level:beginner (1 file), quality:clean, type:testing, mentor:Aamod007

@Aamod007 Aamod007 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewing after noting the only CI failure is Vercel authorization (not code-related). All other checks (Format · Lint · Typecheck · Test, Production Build, CodeQL) pass. Approving — the Vercel deploy auth is a repo-level config issue, not a code problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

level:beginner Small changes Usually isolated fixes or simple UI/text updates. mentor:Aamod007 quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. type:testing Adding, updating, or fixing tests

Projects

None yet

2 participants