

# Testing standards [#testing-standards]

Use this page when you need to decide which tests and validation evidence a
tax behaviour change needs.

## Required evidence by change [#required-evidence-by-change]

| Change           | Required evidence                                                                                        |
| ---------------- | -------------------------------------------------------------------------------------------------------- |
| Fact             | schema decode tests, graph validation, type tests if public input types change                           |
| Rule             | source reference validation, graph checks, golden tests, trace snapshots when rule IDs or ledgers change |
| Calculator       | schema tests, golden tests, graph validation, API compatibility tests and SDK compatibility tests        |
| Tax year         | parameter schema validation, effective-date checks, golden tests, API metadata tests and SDK type tests  |
| Incorrect result | failing regression first, source citation, passing golden test and compatibility notes                   |

## Test types [#test-types]

Golden tests should use official examples or reviewed scenarios and live with
the rule package they validate.

Type tests should prove public SDK descriptors reject unsupported facts,
calculator IDs, jurisdictions and tax years at compile time.

API compatibility tests should prove `CalculatorRunRequest`,
`CalculatorRunResponse` and route-owned error envelopes still match public
HTTP expectations.

SDK compatibility tests should prove `TaxKit.calculate`,
`TaxKit.safe.calculate`, `calculateRunRequest`, `calculateReportRequest`,
`calculateReport` and jurisdiction helpers still infer the expected input,
report and error types.

## Commands [#commands]

Use package-specific commands when your change is local:

```sh
bun run --filter=@taxkit/rules-au-pay test
bun run --filter=@taxkit/rules-au-income-tax test
bun run --filter=@taxkit/rules-au-stsl test
bun run --filter=@taxkit/calculators test
bun run --filter=@taxkit/api-http test
bun run --filter=@taxkit/sdk test-types
```

Before handoff, run the repository gate:

```sh
bun run verification
```

## Source of truth [#source-of-truth]

For the full quality model, read
[Testing and quality](https://github.com/crcorbett/taxkit/blob/a151e51e8a30247526fa93412df046955846eca4/docs/architecture/testing-and-quality.md)
and
[Testing and validation](https://github.com/crcorbett/taxkit/blob/a151e51e8a30247526fa93412df046955846eca4/docs/architecture/testing-and-validation.md).
