Testing: unit tests for the PNG and SVG credit helpers

Closed Beginner friendly
#245 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
86/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
testing

Research direction

Start with lib/export/credit.ts to see how withPngCredit and withSvgCredit build their output, then read lib/icons/ico.test.ts as the model for testing binary output. Write a Vitest file that checks the PNG signature, the tEXt chunk before IEND with a valid CRC, and unchanged image data, plus SVG credit idempotence and well-formedness. Done when pnpm test passes and the three acceptance criteria are covered.

Written by the indexing model from the issue text.

Description

area: ui difficulty: easy good first issue testing

Summary

Add Vitest tests for lib/export/credit.ts (withPngCredit, withSvgCredit), which add the Made with DesignHub credit to exported files.

Where to look

  • lib/export/credit.ts
  • lib/icons/ico.test.ts: an example of testing binary output

Acceptance criteria

  • withPngCredit keeps the PNG signature, inserts a tEXt chunk before IEND with a correct CRC and leaves the image data untouched.
  • withSvgCredit adds the credit once (running it twice does not duplicate it) and keeps the SVG well-formed.
  • pnpm test passes.

Getting started: fork the repo, then pnpm install and pnpm dev (Node 22+, pnpm 11, no API keys). Before opening a PR, run pnpm typecheck && pnpm test && pnpm lint && pnpm format:check && pnpm check:dashes && pnpm build. See CONTRIBUTING.md and the first contribution walkthrough.

Everything needed is in the repository. This doesn't need maintainer access, secrets or paid services. Comment below to claim it, and ask questions here any time.

Dominant language
TypeScript
Stars
11
Forks
3
Avg merge
5h 23m
Merged PRs (30d)
74

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from yakew7/DesignHub

All issues in yakew7/DesignHub

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.