@orchestrator-ui/orchestrator-ui-components 8.7.0 → 8.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +8 -8
- package/.turbo/turbo-lint.log +1 -1
- package/.turbo/turbo-test.log +11 -11
- package/CHANGELOG.md +7 -0
- package/dist/index.d.ts +379 -1244
- package/dist/index.js +936 -1013
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/WfoPydanticForm/fields/WfoSummary.tsx +42 -7
- package/src/components/WfoSearchPage/WfoFilterGroup/WfoFilterGroup.tsx +1 -1
- package/src/configuration/version.ts +1 -1
- package/src/messages/en-GB.json +452 -578
- package/src/messages/getTranslationMessages.spec.ts +47 -30
- package/src/messages/nl-NL.json +450 -430
|
@@ -1,36 +1,53 @@
|
|
|
1
|
-
describe('getTransalationMessages', () => {
|
|
2
|
-
it('Makes jest stop complaining about an empty test file', () => {
|
|
3
|
-
expect(true).toEqual(true);
|
|
4
|
-
});
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
export {};
|
|
8
|
-
/*
|
|
9
|
-
These tests are disabled because of an issue described here:
|
|
10
|
-
https://github.com/workfloworchestrator/orchestrator-ui/issues/513
|
|
11
|
-
|
|
12
1
|
import { Locale } from '../types';
|
|
13
2
|
import enGB from './en-GB.json';
|
|
14
3
|
import nlNL from './nl-NL.json';
|
|
15
4
|
import { useGetTranslationMessages } from './useGetTranslationMessages';
|
|
5
|
+
|
|
6
|
+
jest.mock('../rtk/endpoints/translations', () => ({
|
|
7
|
+
useTranslationsQuery: () => ({ data: undefined, isLoading: false }),
|
|
8
|
+
}));
|
|
9
|
+
|
|
10
|
+
// The hook merges backend translations into the local messages; with the
|
|
11
|
+
// query mocked to return nothing, that merge adds an empty object.
|
|
12
|
+
const withEmptyBackendTranslations = (messages: typeof enGB) => ({
|
|
13
|
+
...messages,
|
|
14
|
+
pydanticForms: {
|
|
15
|
+
...messages.pydanticForms,
|
|
16
|
+
backendTranslations: {},
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const getTranslationKeys = (messages: object, prefix = ''): string[] =>
|
|
21
|
+
Object.entries(messages).flatMap(([key, value]) =>
|
|
22
|
+
value && typeof value === 'object' ? getTranslationKeys(value, `${prefix}${key}.`) : [`${prefix}${key}`],
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
describe('translation files', () => {
|
|
26
|
+
it('en-GB.json and nl-NL.json contain the same translation keys', () => {
|
|
27
|
+
const enGBKeys = getTranslationKeys(enGB).sort();
|
|
28
|
+
const nlNLKeys = getTranslationKeys(nlNL).sort();
|
|
29
|
+
|
|
30
|
+
expect(nlNLKeys).toEqual(enGBKeys);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
16
34
|
describe('useGetTranslationMessages', () => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
it('Returns nl-NL translation when nl-NL locale is requested', () => {
|
|
36
|
+
const translation = useGetTranslationMessages(Locale.nlNL);
|
|
37
|
+
expect(translation).toEqual(withEmptyBackendTranslations(nlNL));
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('Returns en-GB translation when en-GB locale is requested', () => {
|
|
41
|
+
const translation = useGetTranslationMessages(Locale.enGB);
|
|
42
|
+
expect(translation).toEqual(withEmptyBackendTranslations(enGB));
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('Returns en-GB translation when no locale is requested', () => {
|
|
46
|
+
const translation = useGetTranslationMessages(undefined);
|
|
47
|
+
expect(translation).toEqual(withEmptyBackendTranslations(enGB));
|
|
48
|
+
});
|
|
49
|
+
it('Returns en-GB translation unknown locale is requested', () => {
|
|
50
|
+
const translation = useGetTranslationMessages('UNKNOWN-LOCALE');
|
|
51
|
+
expect(translation).toEqual(withEmptyBackendTranslations(enGB));
|
|
52
|
+
});
|
|
35
53
|
});
|
|
36
|
-
*/
|