test contracts

This commit is contained in:
2026-02-26 19:40:00 +03:00
parent 626449604f
commit 2b8e20981e
35 changed files with 1811 additions and 759 deletions

View File

@@ -59,6 +59,20 @@ export function normalizeApiError(error) {
// @PURPOSE: Fetch unified report list using existing request wrapper.
// @PRE: valid auth context for protected endpoint.
// @POST: Returns parsed payload or structured error for UI-state mapping.
//
// @TEST_CONTRACT: GetReportsApi ->
// {
// required_fields: {},
// optional_fields: {options: Object},
// invariants: [
// "Fetches from /reports with built query string",
// "Returns response payload on success",
// "Catches and normalizes errors using normalizeApiError"
// ]
// }
// @TEST_FIXTURE: valid_get_reports -> {"options": {"page": 1}}
// @TEST_EDGE: api_fetch_failure -> api.fetchApi throws error
// @TEST_INVARIANT: error_normalization -> verifies: [api_fetch_failure]
export async function getReports(options = {}) {
try {
console.log("[reports][api][getReports:STARTED]", options);