From open-agreements
Guides risk-based unit testing with Allure behavioral specs for Open Agreements repos. Focuses on regression prevention, high-risk behavior first, and readable test steps.
How this skill is triggered — by the user, by Claude, or both
Slash command
/open-agreements:unit-test-philosophyThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
- This skill is **guidance only** — it does not execute tests or modify code directly.
src/, integration-tests/, packages/contracts-workspace, or packages/contracts-workspace-mcp.Execute test body.integration-tests/helpers/allure-test.tsitAllure, testAllure, allureStep, allureJsonAttachment, allurePrettyJsonAttachment, allureWordLikeTextAttachment, allureParameter, allureSeverityallure-vitest in tests.src/**/*.test.ts and integration-tests/**/*.test.ts.scripts/patch_allure_html_sanitizer.mjs, invoked by npm run report:allure). Do not bypass this pipeline when generating reports for review.src/<module>.test.ts.*.allure.test.ts files to *.test.ts; do not introduce new *.allure.test.ts files..openspec('OA-###') whenever a matching scenario ID exists for the behavior.openspec/specs/open-agreements/spec.md) or active change-package specs (openspec/changes/<change-id>/specs/open-agreements/spec.md).src/core/** and integration flows.critical: mutation correctness, legal-output integrity, data-loss risk, security/policy guardrails.normal: standard behavior and compatibility scenarios.minor: narrow edge cases with low production impact.npm run test:run
npm run test:coverage
npm run check:spec-coverage
npm run check:allure-labels
import { describe, expect } from 'vitest';
import { itAllure as it, allureStep, allureJsonAttachment } from '../../../integration-tests/helpers/allure-test.js';
describe('checklist patch behavior', () => {
it('applies replacement deterministically', async () => {
let result: { ok: boolean };
await allureStep('Given a valid patch payload', async () => {
await allureJsonAttachment('patch-input.json', {
patch_id: 'patch_001',
operations: [{ op: 'replace', path: '/issues/0/status', value: 'CLOSED' }],
});
});
await allureStep('When patch validation runs', async () => {
result = { ok: true };
});
await allureStep('Then validation succeeds', async () => {
expect(result!.ok).toBe(true);
});
});
});
references/allure-test-spec-writing-guide.md for full Allure step-writing guidance.npx claudepluginhub open-agreements/open-agreementsCreates and manages unit and integration tests by analyzing codebase, auto-detecting test frameworks, and generating tests that follow project conventions.
Enforces a test-driven development workflow with edge-case-first testing, strong assertions, and GIVEN/WHEN/SHOULD naming. Useful when writing or reviewing tests.
Provides a checklist for writing and reviewing tests: naming tests/files, designing data/fixtures/mocks, choosing assertions. Use for unit/integration/E2E tests.