beautyline-lib-and-tests
Placement of helpers, queries, serializers, and Vitest tests under src/lib for Beautyline. Use when adding business logic, API helpers, course/product/equipment queries, constants, or unit tests besid
SKILL.md.cursor/skills/beautyline-lib-and-tests/SKILL.md
GitHubBeautyline: lib layer and tests
Role of src/lib/
- Pure/domain logic, query helpers, slug rules, serializers to public JSON shapes (
public-course,public-product,display-text, token-like constants (course-types,product-brands). - Prefer thin route handlers and page loaders that delegate to
@/lib/...for heavy logic rather than embedding long logic inpage.tsx.
Naming and cohesion
- One concern per file where feasible (matching existing granular modules).
- Stable constants and enums used across admin and storefront live here when not tied to a single component.
Tests
- Vitest:
npm test/npm run test:watch. - Place
*.test.tsor*.test.tsxnext to the module under test (existing example:src/lib/auth.test.ts). - Expand tests for non-trivial new
libbehavior (serialization edge cases, auth utilities, deterministic queries) rather than skipping tests for complex additions.
Imports
- Consumers import from
@/lib/<module>— keep public exports at the bottom of modules clear (named exports preferred for tree-shaking and grep-ability).