|
43 | 43 | import { describe, it, expect } from 'vitest'; |
44 | 44 | import { checkManagedApiMethodAffordances } from '@objectstack/spec/data'; |
45 | 45 | 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'; |
46 | 50 |
|
47 | 51 | describe('#15873 — sys_organization.enable.apiMethods admits `update`, and only `update`', () => { |
48 | 52 | 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', () => |
89 | 93 | expect(create.target).toBe('/api/v1/auth/organization/create'); |
90 | 94 | }); |
91 | 95 | }); |
| 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