Skip to content

Commit 859a042

Browse files
committed
test(platform-objects): require_mfa help carries the two-factor condition in every locale (WIP)
Claude-Session: https://claude.ai/code/session_01Utp6Cai3TgWyncLtR5EwF7 Co-authored-by: Claude <noreply@anthropic.com>
1 parent fe50ecf commit 859a042

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

‎packages/platform-objects/src/identity/sys-organization-update-door.test.ts‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@
4343
import { describe, it, expect } from 'vitest';
4444
import { checkManagedApiMethodAffordances } from '@objectstack/spec/data';
4545
import { SysOrganization } from './sys-organization.object';
46+
import { enObjects } from '../apps/translations/en.objects.generated.js';
47+
import { esESObjects } from '../apps/translations/es-ES.objects.generated.js';
48+
import { jaJPObjects } from '../apps/translations/ja-JP.objects.generated.js';
49+
import { zhCNObjects } from '../apps/translations/zh-CN.objects.generated.js';
4650

4751
describe('#15873 — sys_organization.enable.apiMethods admits `update`, and only `update`', () => {
4852
it('declares exactly get / list / update — no create, no delete, no bulk', () => {
@@ -89,3 +93,23 @@ describe('#15873 — better-auth keeps its own door for its own columns', () =>
8993
expect(create.target).toBe('/api/v1/auth/organization/create');
9094
});
9195
});
96+
97+
describe('#30411 — require_mfa\'s help says it needs two-factor on, in the source and in every locale', () => {
98+
const bundles = { en: enObjects, 'zh-CN': zhCNObjects, 'ja-JP': jaJPObjects, 'es-ES': esESObjects };
99+
100+
it('the source description names the deployment switch the save is refused without', () => {
101+
const description = SysOrganization.fields.require_mfa?.description;
102+
expect(description).toMatch(/two-factor authentication on for this deployment/);
103+
expect(description).toMatch(/OS_AUTH_TWO_FACTOR=true/);
104+
});
105+
106+
it.each(Object.entries(bundles))('%s: the generated help carries the condition', (_locale, bundle) => {
107+
const help = (bundle as any).sys_organization?.fields?.require_mfa?.help;
108+
expect(help).toEqual(expect.any(String));
109+
expect(help).toMatch(/OS_AUTH_TWO_FACTOR=true/);
110+
});
111+
112+
it('the en bundle is the source, verbatim (the generator writes it)', () => {
113+
expect((enObjects as any).sys_organization.fields.require_mfa.help).toBe(SysOrganization.fields.require_mfa?.description);
114+
});
115+
});

0 commit comments

Comments
 (0)