test contracts
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user