Repository navigation
Expand file tree
/
Copy pathstudioAutomationCopy.plainLanguage-11659.test.ts
More file actions
89 lines (80 loc) · 3.79 KB
/
Copy pathstudioAutomationCopy.plainLanguage-11659.test.ts
File metadata and controls
89 lines (80 loc) · 3.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
/**
* objectui#11659 ruling 6 — Studio's automation pillar speaks plain language
* in zh.
*
* The cloud acceptance run read 「自动化 · flow」 over the automation list and
* 「默认 OFF · 审阅后再启用」 in the pillar's top bar: an internal metadata type
* and an English switch state, inside Chinese copy. This pins the property, not
* the wording: no zh row the pillar's chrome reads carries the metadata type
* `flow` or the English `ON` / `OFF`. The rows are read through the same `t()`
* the pillar calls, and each is first checked to be a real zh row (not the key
* echoed back, not the en row), so a missing row cannot pass.
*
* Out of this pin by design: the identifier placeholder's example
* (`offer_notice`) and author data such as a flow's own name.
*/
import { describe, expect, it } from 'vitest';
import { t } from './i18n';
// `engine.studio.auto.*` lives in `@object-ui/i18n`'s `studio` namespace, whose
// `zh` catalogue is fetched on demand (objectstack#25922). Resident before any
// case: this file runs in the `unit` project, whose shared module graph would
// otherwise let it pass only when another file had loaded `zh` first.
import { loadStudioCatalogue } from '@object-ui/i18n/namespaces/studio';
await loadStudioCatalogue('zh');
/**
* The flow designer's chrome: every `engine.studio.auto.*` row it renders as
* prose. objectstack#36903 — the rail's heading and empty rows went with the
* rail.
*/
const PILLAR_ROWS = [
'engine.studio.auto.defaultOff',
'engine.studio.auto.canvasHint',
'engine.studio.auto.on',
'engine.studio.auto.off',
'engine.studio.auto.offTitle',
'engine.studio.auto.onBound',
'engine.studio.auto.onUnbound',
// objectui#11779 — the run status's "not running here" and "not deployed" words.
'engine.studio.auto.notRunning',
'engine.studio.auto.notRunningTitle',
'engine.studio.auto.unpublishedTitle',
'engine.studio.auto.enabled',
'engine.studio.auto.disabled',
'engine.studio.auto.enableTitle',
'engine.studio.auto.disableTitle',
'engine.studio.auto.enabledToast',
'engine.studio.auto.disabledToast',
'engine.studio.auto.newTitle',
'engine.studio.auto.config',
'engine.studio.auto.emptyLine1',
'engine.studio.auto.emptyLine2',
'engine.studio.auto.savedDraft',
] as const;
/** ASCII tokens that are internal vocabulary inside zh copy. `\b` holds next to CJK, which is not `\w`. */
const INTERNAL_TOKENS = [/\bflow\b/i, /\bOFF\b/, /\bON\b/];
describe('Studio automation pillar — zh copy is plain language (objectui#11659)', () => {
it('every pillar row is a real zh row', () => {
for (const key of PILLAR_ROWS) {
const zh = t(key, 'zh-CN');
expect(zh, `${key}: a missing zh row echoes the key back`).not.toBe(key);
expect(zh, `${key}: the zh row must not be the English one`).not.toBe(t(key, 'en-US'));
}
});
it('no zh pillar row carries the metadata type `flow` or an English ON/OFF', () => {
const offenders = PILLAR_ROWS.flatMap((key) => {
const zh = t(key, 'zh-CN');
return INTERNAL_TOKENS.filter((re) => re.test(zh)).map((re) => `${key}: ${re} in 「${zh}」`);
});
expect(offenders).toEqual([]);
});
it('the regexes see the tokens they are meant to catch (positive control)', () => {
expect(INTERNAL_TOKENS[0].test('自动化 · flow')).toBe(true);
expect(INTERNAL_TOKENS[1].test('默认 OFF · 审阅后再启用')).toBe(true);
expect(INTERNAL_TOKENS[1].test('默认OFF')).toBe(true);
expect(INTERNAL_TOKENS[2].test('已 ON')).toBe(true);
});
// objectstack#36903 — the pillar's en heading (`engine.studio.auto.heading`)
// went with the rail and is retired in 19.0.0 (ruling 7153171432), so its
// case went with it; the designer's rows above carry the plain-language pin.
});