fix: correct EvidenceReference field name in bulk verification handler - #1
Open
esthereze wants to merge 1 commit into
Open
fix: correct EvidenceReference field name in bulk verification handler#1esthereze wants to merge 1 commit into
esthereze wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
BulkCheckInResulttype insrc/routes/verifications.tsdeclared itsevidenceReferenceshape with anevidenceReferenceUrlfield, but the authoritativeEvidenceReferenceinterface insrc/services/evidence.tsusesreferenceUrl. This causedTS2741: Property 'evidenceReferenceUrl' is missing in type 'EvidenceReference'when assigning the result ofcreateEvidenceReference()toitemResult.evidenceReference.Changes
src/routes/verifications.tsEvidenceReferencefromevidence.jsand use it directly inBulkCheckInResultinstead of an inline type with the wrong field name — resolves TS2741AppErrorerror-code mapping in the bulk handler to useerror.codeanderror.statusinstead of the non-existenterror.statusCodeproperty (resolves TS2339)src/tests/verifications.bulk.test.tsrequireAdminto therbac.jsmock so the module loads correctly (previously the suite failed to run at all)AppErrorresponse shapeevidenceRef.referenceUrl === REF_URLandevidenceRef.evidenceReferenceUrl === undefinedTest results
All 19 tests pass (previously the test suite failed to load due to the missing
requireAdminmock export).Closes Disciplr-Org#993