Ana içeriğe geç
Bu sayfa henüz Türkçeye çevrilmedi; İngilizce sürümü gösteriliyor.
Versiyon: 1.0

Testing and Design System

Conventions for contributors: how tools are tested and how the UI is styled.

Unit tests​

Tests focus on a tool's pure transformation logic in logic.ts. They use Vitest; test files match src/**/*.test.ts.

pnpm test          # run once
pnpm test:watch # watch mode

What to test:

  • Happy path: the core transformation produces the expected output.
  • Edge cases: empty input, whitespace, Unicode/multibyte, very large input, malformed input, boundary values.
  • Round-trips: encode/decode and to/from conversions should be lossless.
  • Error handling: invalid input gives a helpful error, not a crash.

Test observable behaviour, not the implementation, so refactors do not break the suite for no reason.

import { describe, expect, it } from "vitest";
import { decodeBase64, encodeBase64 } from "./logic";

describe("base64", () => {
it("encodes ASCII", () => {
expect(encodeBase64("hello")).toBe("aGVsbG8=");
});

it("round-trips Unicode", () => {
const s = "héllo 😀 世界";
expect(decodeBase64(encodeBase64(s))).toBe(s);
});

it("throws on invalid characters", () => {
expect(() => decodeBase64("not*base*64")).toThrow();
});
});

A few tools have no pure logic because the work is the browser API itself (canvas, the File API, navigator, contenteditable): qr-generator, barcode-generator, base64-image, image-compressor, csv-viewer, device-information and html-wysiwyg-editor. For these, the end-to-end tests are the coverage.

End-to-end tests​

Playwright specs in tests/*.spec.ts drive a real browser. They cover the app shell (search, command palette, theme, routing), a functional test for every tool, Send To, and the server-rendered tool page content.

# first time: download the browser
pnpm exec playwright install chromium

pnpm test:e2e # headless run (starts the dev server automatically)
pnpm test:e2e:ui # interactive UI mode

By default Playwright starts pnpm dev and tests http://localhost:3000. Set PLAYWRIGHT_BASE_URL to test an already-running server instead.

Before a pull request​

pnpm typecheck && pnpm lint && pnpm test && pnpm build

Run pnpm test:e2e as well when you touch UI flows.

Design system​

The product should feel like a serious developer utility. Visual hierarchy comes from typography, spacing, borders, elevation and one accent colour.

Design constraints:

  • No purple as a primary or secondary colour.
  • No gradients, glassmorphism, glowing elements or heavy shadows.
  • A neutral palette (black, near-black, white, gray) with subtle borders.
  • One accent colour, used consistently.
  • Compact, information-dense and keyboard-friendly.

Theme tokens​

All colours are semantic CSS variables in src/app/globals.css, for both light and dark themes, mapped to Tailwind utilities such as bg-surface, text-foreground, border-border and text-accent.

// Do
<div className="bg-surface text-foreground border-border" />

// Don't
<div style={{ background: "#111", color: "#fff", border: "1px solid #343434" }} />

Shared components​

ComponentPurpose
ToolEditorCodeMirror 6 editor: syntax highlighting, line numbers, folding, search.
ConverterLayoutTwo-column input/output (collapses on mobile).
Buttonprimary / secondary / ghost, sm / md.
CopyButtonClipboard copy with "Copied" feedback.
FavoriteButtonStar / unstar a tool.
ExecutionBadgePrivacy indicator from execution metadata.
SendToMenuSend To dropdown.
ToolHeaderTitle, description, badges, breadcrumbs.
ToolCardHomepage/search card.

Accessibility​

  • Keyboard navigation everywhere (the command palette is fully keyboard-driven).
  • Real labels (aria-label), visible focus outlines and semantic HTML.
  • Sufficient contrast in both themes.