|
| 1 | +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. |
| 2 | +// |
| 3 | +// The Business Unit page says what a unit does in the open edition, and what |
| 4 | +// needs the enterprise edition (#30210 row 1). It used to say units are "used |
| 5 | +// to scope data and reports", while scoping a permission set's read access by |
| 6 | +// unit (`readScope: 'unit'` and the other hierarchy scopes) is refused at |
| 7 | +// compile without `requires: ['hierarchy-security']`, which only |
| 8 | +// `@objectstack/security-enterprise` provides. What does work in the open |
| 9 | +// edition is a sharing rule naming a unit (or a unit and the units under it), |
| 10 | +// whose access follows membership in and out. |
| 11 | +// |
| 12 | +// The unit's `timezone` help used to say date boundaries are computed in it. |
| 13 | +// Nothing reads the column (the same reading as `sys_organization.timezone`, |
| 14 | +// pinned in `sys-organization-name-timezone-help.test.ts`), so the help says |
| 15 | +// which setting is in effect instead. |
| 16 | +import { describe, expect, it } from 'vitest'; |
| 17 | +import { SysBusinessUnit } from './sys-business-unit.object.js'; |
| 18 | +import { zhCNObjects } from '../apps/translations/zh-CN.objects.generated.js'; |
| 19 | + |
| 20 | +const zhUnit = () => |
| 21 | + (zhCNObjects as unknown as Record<string, { description?: string; fields?: Record<string, { help?: string }> }>) |
| 22 | + .sys_business_unit; |
| 23 | + |
| 24 | +describe('sys_business_unit: the page says what the open edition gives and what needs enterprise (#30210)', () => { |
| 25 | + it('names sharing rules as what a unit drives, and the enterprise requirement for unit-scoped read access', () => { |
| 26 | + const d = SysBusinessUnit.description ?? ''; |
| 27 | + expect(d).toMatch(/[Ss]haring rules/); |
| 28 | + expect(d).toMatch(/enterprise edition/); |
| 29 | + expect(d).not.toMatch(/used to scope data and reports/); |
| 30 | + }); |
| 31 | + |
| 32 | + it('the zh-CN page text says the same, not the old scoping claim', () => { |
| 33 | + const d = zhUnit()?.description ?? ''; |
| 34 | + expect(d).toMatch(/共享规则/); |
| 35 | + expect(d).toMatch(/企业版/); |
| 36 | + expect(d).not.toMatch(/划定数据和报表的范围/); |
| 37 | + }); |
| 38 | + |
| 39 | + it('the zh-CN timezone help no longer says date boundaries are computed in it', () => { |
| 40 | + const help = zhUnit()?.fields?.timezone?.help ?? ''; |
| 41 | + expect(help).toMatch(/不会改变任何日期计算/); |
| 42 | + expect(help).not.toMatch(/计算日期边界所用/); |
| 43 | + }); |
| 44 | + |
| 45 | + it("the timezone help says it changes no date calculation and that Localization's Default timezone wins", () => { |
| 46 | + const help = (SysBusinessUnit.fields as Record<string, { description?: string }>).timezone.description ?? ''; |
| 47 | + expect(help).toMatch(/does not change any date calculation/); |
| 48 | + expect(help).toMatch(/Settings → Localization → Default timezone/); |
| 49 | + expect(help).not.toMatch(/are computed in/); |
| 50 | + }); |
| 51 | +}); |
0 commit comments