diff --git a/extension/src/shared/__tests__/error-copy.test.ts b/extension/src/shared/__tests__/error-copy.test.ts index 5e44b0d..d16fdf2 100644 --- a/extension/src/shared/__tests__/error-copy.test.ts +++ b/extension/src/shared/__tests__/error-copy.test.ts @@ -41,4 +41,15 @@ describe('ERROR_COPY', () => { expect(copy.title).toBe('Something went wrong'); expect(copy.body).toContain('made_up_code_xyz'); }); + + // The discovery test above only catches codes returned via `ok: false, error: ''` + // (org_not_configured). The other user-facing org errors are thrown (-> e.message -> + // humanizeError), so assert they resolve to real copy rather than the generic fallback. + it('maps the user-facing org error codes to friendly copy', () => { + for (const code of ['org_not_configured', 'not_an_org_member', 'device_key_unavailable']) { + const copy = lookupErrorCopy(code); + expect(copy.title).not.toBe('Something went wrong'); + expect(copy.body).not.toBe(code); + } + }); }); diff --git a/extension/src/shared/error-copy.ts b/extension/src/shared/error-copy.ts index 256a794..bd5377b 100644 --- a/extension/src/shared/error-copy.ts +++ b/extension/src/shared/error-copy.ts @@ -100,6 +100,20 @@ export const ERROR_COPY: Record = { body: 'Run setup to save your reference image.', cta: { label: 'Open setup', action: 'open_setup' }, }, + // --- Org (enterprise) context errors (v0.9.0 Plan B) --- + org_not_configured: { + title: 'Org not set up here', + body: 'This organization is not configured on this device yet. Add it from the vault switcher before browsing its items.', + }, + not_an_org_member: { + title: 'Not a member', + body: "This device isn't a member of that organization — ask an org admin to add your device key.", + }, + device_key_unavailable: { + title: 'Device key unavailable', + body: 'Your device key could not be restored. Lock and unlock your vault to refresh it, then try again.', + cta: UNLOCK_CTA, + }, }; export function lookupErrorCopy(code: string): ErrorCopy {