Test gaps: field-definition 403 (backend) + authority-kind reveal (frontend) #37
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Minor test-coverage gaps noted in the Fields Management final review (non-blocking):
Backend 403 path.
crates/api/tests/admin_fields.rscovers401(unauthenticated) but not authenticated-with-insufficient-capability →403. TheAuthorized<EditCatalogue>extractor is exercised by other test files, so risk is low, but a dedicated case (e.g. a viewer/read-only role POSTing → 403) would close the gap. (Confirm a non-EditCataloguerole exists to seed.)Frontend authority-kind reveal.
web/src/fields/fields.test.tsxcovers the Term branch (selecting type=term reveals the vocabulary picker and blocks submit until one is chosen) but not the Authority branch (field-form.tsxdataType === "authority"→ the kind<select>with Any/Person/Organisation/Place). A test that selects type=authority, picks a kind, and asserts the postedauthority_kindwould cover it. (The backendcreate_authority_fieldtest already covers the API side.)Both are low-priority polish — the happy paths and the more complex Term branch are covered.
Resolved in
0d971cd:web/src/fields/fields.test.tsx(selects the Authority type, picks a kind, asserts the postedauthority_kind). Done.Admin,Editor) and both grantEditCatalogue, so no authenticated user can receive a 403 on field-definition create — there is nothing to assert. When a read-only/viewer role is introduced, the 403 coverage should be added then (it'll come naturally with that role's tests).Closing as done for the actionable scope; the 403 case will be picked up with a future viewer role.