Skip to content

fix: correct EvidenceReference field name in bulk verification handler - #1

Open
esthereze wants to merge 1 commit into
mainfrom
fix/evidence-reference-url-field-name
Open

fix: correct EvidenceReference field name in bulk verification handler#1
esthereze wants to merge 1 commit into
mainfrom
fix/evidence-reference-url-field-name

Conversation

@esthereze

Copy link
Copy Markdown
Owner

Summary

The BulkCheckInResult type in src/routes/verifications.ts declared its evidenceReference shape with an evidenceReferenceUrl field, but the authoritative EvidenceReference interface in src/services/evidence.ts uses referenceUrl. This caused TS2741: Property 'evidenceReferenceUrl' is missing in type 'EvidenceReference' when assigning the result of createEvidenceReference() to itemResult.evidenceReference.

Changes

src/routes/verifications.ts

  • Import EvidenceReference from evidence.js and use it directly in BulkCheckInResult instead of an inline type with the wrong field name — resolves TS2741
  • Fix AppError error-code mapping in the bulk handler to use error.code and error.status instead of the non-existent error.statusCode property (resolves TS2339)

src/tests/verifications.bulk.test.ts

  • Add requireAdmin to the rbac.js mock so the module loads correctly (previously the suite failed to run at all)
  • Add an error handler to the test app matching the production AppError response shape
  • Add test: "evidenceReference in response uses referenceUrl field (not evidenceReferenceUrl)" — asserts evidenceRef.referenceUrl === REF_URL and evidenceRef.evidenceReferenceUrl === undefined

Test results

All 19 tests pass (previously the test suite failed to load due to the missing requireAdmin mock export).

Closes Disciplr-Org#993

The BulkCheckInResult type in src/routes/verifications.ts declared its
evidenceReference shape with an evidenceReferenceUrl field, but the
authoritative EvidenceReference interface in src/services/evidence.ts
uses referenceUrl. This caused TS2741 when assigning the result of
createEvidenceReference() to itemResult.evidenceReference.

Changes:
- Import EvidenceReference from evidence.js and use it directly in
  BulkCheckInResult instead of an inline type with the wrong field name
- Fix AppError error-code mapping in bulk handler to use error.code
  and error.status instead of non-existent error.statusCode (TS2339)
- Add requireAdmin to rbac mock so the test module loads correctly
- Add error handler to the test app matching production AppError shape
- Add test asserting evidenceReference.referenceUrl is present in the
  bulk response JSON and evidenceReferenceUrl is absent

Closes Disciplr-Org#993
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EvidenceReference field name mismatch between service and route in the bulk verification handler (src/routes/verifications.ts)

1 participant