Loading...
Loading...
Guardrails for adding unit tests in bklit-ui without over-testing. Use when the user mentions unit test, unit tests, tests, test coverage, add tests, write tests, vitest, jest, or asks whether something should be tested.
npx skill4agent add bklit/bklit-ui unit-tests| Worth testing | Why |
|---|---|
| Pure functions / modules | Stable inputs → outputs; fast; no DOM |
| Formatters, parsers, scale math, bounds | Regression on string/number output is user-visible |
| Codegen / export / registry helpers | Output shape is the contract |
| Non-obvious edge cases | Empty data, reversed ranges, clamping |
chart-formatters.test.tshighlight-segment-bounds.test.tsanimation.test.tsapps/web/lib/studio/__tests__/*| Skip | Why |
|---|---|
| React component render smoke tests | visx, motion, portals → brittle; manual/docs check is cheaper |
| Structural perf refactors; output unchanged; RTL mount assertions are heavy |
| Default prop passthrough | |
| Third-party library behavior | Don’t re-test d3, visx, or React |
| Trivial getters / one-line wrappers | No regression signal |
| Snapshot entire chart SVG/JSX | High churn, low signal |
tsxpnpm test # root — turbo runs packages with a test script
pnpm --filter @bklitui/ui test
cd apps/web && pnpm test**/__tests__/**/*.test.tsimport assert from "node:assert/strict";
import { describe, it } from "node:test";
import { myFn } from "../my-module";
describe("myFn", () => {
it("handles empty input", () => {
assert.equal(myFn([]), expected);
});
});toLocaleDateStringpackage.json"test": "node scripts/run-tests.mjs"scripts/run-tests.mjs*.test.ts__tests__node --import tsx --testtsxturbo.jsontestpnpm testchart-formatters.tspnpm testuseMemoexpect(typeof x).toBe('function')