test: make resolveUserOrganisation a spy so call-count claims are real

↗ view on GitHub · sloth-ninja · 2026-08-13 · 8832de30

Review finding (Minor 2): the "does not resolve membership when payload
has no organisation key" test used a bare closure for the
resolveUserOrganisation mock, so it recorded nothing and the test would
pass under any implementation - the claim was never actually checked.

Replaces the closure with a vi.fn() spy (call-through pattern matching
user.connectorGallery.test.ts) and asserts exact call counts: a
displayName-only PATCH resolves membership exactly once (loadProfile's
own resolve for the response's `firm` field), an organisation-touching
PATCH exactly twice (the belt's resolve + loadProfile's).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Repository Sloth-ninja/JessicaOSS
Author sloth-ninja <ezanahaddis@gmail.com>
Authored
Parents eedbb795
Stats 1 file changed , +36 , -10
Part of Pilot-feedback fixes: firm UI, connector registry, and legacy writes

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-8832de30.md from inside the repo you want the change in.

⬇ Download capture-commit-8832de30.md