@stevenkellner/team-conduct-api 1.0.22 → 1.0.23

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.
Files changed (42) hide show
  1. package/lib/src/functions/fine/add.js +7 -3
  2. package/lib/src/functions/fine/delete.js +5 -3
  3. package/lib/src/functions/fine/update.js +9 -6
  4. package/lib/src/locales/de.d.ts +66 -0
  5. package/lib/src/locales/de.js +99 -0
  6. package/lib/src/locales/en.d.ts +66 -0
  7. package/lib/src/locales/en.js +99 -0
  8. package/lib/src/types/Configuration.d.ts +3 -2
  9. package/lib/src/types/Configuration.js +2 -1
  10. package/lib/src/types/FineAmount.js +3 -3
  11. package/lib/src/types/FineTemplateRepetition.js +3 -3
  12. package/lib/src/types/Localization.d.ts +205 -60
  13. package/lib/src/types/Localization.js +65 -117
  14. package/lib/src/types/PayedState.js +1 -1
  15. package/lib/src/types/Pluralization.d.ts +17 -0
  16. package/lib/src/types/Pluralization.js +33 -0
  17. package/lib/src/types/UserRole.js +1 -1
  18. package/lib/src/types/index.d.ts +1 -0
  19. package/lib/src/types/index.js +1 -0
  20. package/lib/test/localization-utils.d.ts +0 -11
  21. package/lib/test/localization-utils.js +5 -49
  22. package/lib/test/localization.de.test.js +43 -80
  23. package/lib/test/localization.en.test.js +46 -85
  24. package/lib/tsconfig.tsbuildinfo +1 -1
  25. package/package.json +2 -4
  26. package/src/functions/fine/add.ts +7 -3
  27. package/src/functions/fine/delete.ts +5 -3
  28. package/src/functions/fine/update.ts +10 -7
  29. package/src/locales/de.ts +97 -0
  30. package/src/locales/en.ts +97 -0
  31. package/src/types/Configuration.ts +4 -3
  32. package/src/types/FineAmount.ts +3 -3
  33. package/src/types/FineTemplateRepetition.ts +3 -3
  34. package/src/types/Localization.ts +67 -83
  35. package/src/types/PayedState.ts +1 -1
  36. package/src/types/Pluralization.ts +44 -0
  37. package/src/types/UserRole.ts +3 -3
  38. package/src/types/index.ts +1 -0
  39. package/lib/src/locales/de.json +0 -85
  40. package/lib/src/locales/en.json +0 -85
  41. package/src/locales/de.json +0 -85
  42. package/src/locales/en.json +0 -85
@@ -1,75 +1,220 @@
1
- import { Configuration } from './Configuration';
2
- export declare const localizationKey: {
3
- notification: {
4
- fine: {
5
- new: {
6
- title: string;
7
- body: string;
1
+ import { Pluralization } from './Pluralization';
2
+ export declare const localizations: {
3
+ en: {
4
+ notification: {
5
+ fine: {
6
+ new: {
7
+ title: string;
8
+ body: string;
9
+ };
10
+ reminder: {
11
+ title: string;
12
+ body: string;
13
+ };
14
+ stateChange: {
15
+ title: string;
16
+ bodyPayed: string;
17
+ bodyUnpayed: string;
18
+ bodyDeleted: string;
19
+ };
8
20
  };
9
- reminder: {
10
- title: string;
11
- body: string;
21
+ };
22
+ fineAmount: {
23
+ item: {
24
+ type: {
25
+ crateOfBeer: {
26
+ name: string;
27
+ withCount: Pluralization;
28
+ withoutCount: Pluralization;
29
+ };
30
+ };
12
31
  };
13
- stateChange: {
14
- title: string;
15
- bodyPayed: string;
16
- bodyUnpayed: string;
17
- bodyDeleted: string;
32
+ };
33
+ fineTemplateRepetition: {
34
+ item: {
35
+ minute: {
36
+ name: string;
37
+ withCount: Pluralization;
38
+ withoutCount: Pluralization;
39
+ };
40
+ day: {
41
+ name: string;
42
+ withCount: Pluralization;
43
+ withoutCount: Pluralization;
44
+ };
45
+ item: {
46
+ name: string;
47
+ withCount: Pluralization;
48
+ withoutCount: Pluralization;
49
+ };
50
+ count: {
51
+ name: string;
52
+ withCount: Pluralization;
53
+ withoutCount: Pluralization;
54
+ };
18
55
  };
19
56
  };
57
+ payedState: {
58
+ payed: string;
59
+ notPayed: string;
60
+ };
61
+ userRole: {
62
+ personManager: string;
63
+ fineTemplateManager: string;
64
+ fineManager: string;
65
+ teamManager: string;
66
+ };
20
67
  };
21
- fineAmount: {
22
- item: {
23
- type: {
24
- crateOfBeer: string;
68
+ de: {
69
+ notification: {
70
+ fine: {
71
+ new: {
72
+ title: string;
73
+ body: string;
74
+ };
75
+ reminder: {
76
+ title: string;
77
+ body: string;
78
+ };
79
+ stateChange: {
80
+ title: string;
81
+ bodyPayed: string;
82
+ bodyUnpayed: string;
83
+ bodyDeleted: string;
84
+ };
25
85
  };
26
86
  };
27
- };
28
- fineTemplateRepetition: {
29
- item: {
30
- minute: string;
31
- day: string;
32
- item: string;
33
- count: string;
87
+ fineAmount: {
88
+ item: {
89
+ type: {
90
+ crateOfBeer: {
91
+ name: string;
92
+ withCount: Pluralization;
93
+ withoutCount: Pluralization;
94
+ };
95
+ };
96
+ };
34
97
  };
35
- };
36
- payedState: {
37
- payed: string;
38
- notPayed: string;
39
- };
40
- userRole: {
41
- personManager: string;
42
- fineTemplateManager: string;
43
- fineManager: string;
44
- teamManager: string;
45
- };
46
- };
47
- export declare const localizationNKey: {
48
- fineAmount: {
49
- item: {
50
- type: {
51
- crateOfBeer: string;
52
- crateOfBeerWithoutCount: string;
98
+ fineTemplateRepetition: {
99
+ item: {
100
+ minute: {
101
+ name: string;
102
+ withCount: Pluralization;
103
+ withoutCount: Pluralization;
104
+ };
105
+ day: {
106
+ name: string;
107
+ withCount: Pluralization;
108
+ withoutCount: Pluralization;
109
+ };
110
+ item: {
111
+ name: string;
112
+ withCount: Pluralization;
113
+ withoutCount: Pluralization;
114
+ };
115
+ count: {
116
+ name: string;
117
+ withCount: Pluralization;
118
+ withoutCount: Pluralization;
119
+ };
53
120
  };
54
121
  };
55
- };
56
- fineTemplateRepetition: {
57
- item: {
58
- minute: string;
59
- minuteWithoutCount: string;
60
- day: string;
61
- dayWithoutCount: string;
62
- item: string;
63
- itemWithoutCount: string;
64
- count: string;
65
- countWithoutCount: string;
122
+ payedState: {
123
+ payed: string;
124
+ notPayed: string;
125
+ };
126
+ userRole: {
127
+ personManager: string;
128
+ fineTemplateManager: string;
129
+ fineManager: string;
130
+ teamManager: string;
66
131
  };
67
132
  };
68
133
  };
134
+ export type SubLocalizationType = {
135
+ [Key in string]: SubLocalizationType;
136
+ } | string | Pluralization;
137
+ export type SubLocalization<T extends SubLocalizationType> = T extends {
138
+ [Key in string]: SubLocalizationType;
139
+ } ? {
140
+ [Key in keyof T]: SubLocalization<T[Key]>;
141
+ } : T extends string ? ValueLocalization : T extends Pluralization ? PluralLocalization : never;
142
+ export declare class ValueLocalization {
143
+ private readonly rawValues;
144
+ constructor(rawValues: Record<keyof typeof localizations, string>);
145
+ value(args?: Record<string, string>): string;
146
+ }
147
+ export declare class PluralLocalization {
148
+ private readonly pluralizations;
149
+ constructor(pluralizations: Record<keyof typeof localizations, Pluralization>);
150
+ value(count: number, args?: Record<string, string>): string;
151
+ }
69
152
  export declare class Localization {
70
- static readonly shared: Localization;
71
- private constructor();
72
- setLocale(locale: Configuration.Locale): void;
73
- get(getKey: (key: typeof localizationKey) => string, ...args: string[]): string;
74
- getN(getKey: (key: typeof localizationNKey) => string, count: number): string;
153
+ static locale: keyof typeof localizations;
154
+ static readonly shared: {
155
+ notification: {
156
+ fine: {
157
+ new: {
158
+ title: ValueLocalization;
159
+ body: ValueLocalization;
160
+ };
161
+ reminder: {
162
+ title: ValueLocalization;
163
+ body: ValueLocalization;
164
+ };
165
+ stateChange: {
166
+ title: ValueLocalization;
167
+ bodyPayed: ValueLocalization;
168
+ bodyUnpayed: ValueLocalization;
169
+ bodyDeleted: ValueLocalization;
170
+ };
171
+ };
172
+ };
173
+ fineAmount: {
174
+ item: {
175
+ type: {
176
+ crateOfBeer: {
177
+ name: ValueLocalization;
178
+ withCount: PluralLocalization;
179
+ withoutCount: PluralLocalization;
180
+ };
181
+ };
182
+ };
183
+ };
184
+ fineTemplateRepetition: {
185
+ item: {
186
+ minute: {
187
+ name: ValueLocalization;
188
+ withCount: PluralLocalization;
189
+ withoutCount: PluralLocalization;
190
+ };
191
+ day: {
192
+ name: ValueLocalization;
193
+ withCount: PluralLocalization;
194
+ withoutCount: PluralLocalization;
195
+ };
196
+ item: {
197
+ name: ValueLocalization;
198
+ withCount: PluralLocalization;
199
+ withoutCount: PluralLocalization;
200
+ };
201
+ count: {
202
+ name: ValueLocalization;
203
+ withCount: PluralLocalization;
204
+ withoutCount: PluralLocalization;
205
+ };
206
+ };
207
+ };
208
+ payedState: {
209
+ payed: ValueLocalization;
210
+ notPayed: ValueLocalization;
211
+ };
212
+ userRole: {
213
+ personManager: ValueLocalization;
214
+ fineTemplateManager: ValueLocalization;
215
+ fineManager: ValueLocalization;
216
+ teamManager: ValueLocalization;
217
+ };
218
+ };
219
+ private static getSubLocalization;
75
220
  }
@@ -1,128 +1,76 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.Localization = exports.localizationNKey = exports.localizationKey = void 0;
37
- const i18n = __importStar(require("i18n"));
38
- const Configuration_1 = require("./Configuration");
39
- exports.localizationKey = {
40
- notification: {
41
- fine: {
42
- new: {
43
- title: 'notification.fine.new.title',
44
- body: 'notification.fine.new.body'
45
- },
46
- reminder: {
47
- title: 'notification.fine.reminder.title',
48
- body: 'notification.fine.reminder.body'
49
- },
50
- stateChange: {
51
- title: 'notification.fine.state-change.title',
52
- bodyPayed: 'notification.fine.state-change.body-payed',
53
- bodyUnpayed: 'notification.fine.state-change.body-unpayed',
54
- bodyDeleted: 'notification.fine.state-change.body-deleted'
55
- }
56
- }
57
- },
58
- fineAmount: {
59
- item: {
60
- type: {
61
- crateOfBeer: 'fineAmount.item.type.crateOfBeer'
62
- }
63
- }
64
- },
65
- fineTemplateRepetition: {
66
- item: {
67
- minute: 'fineTemplateRepetition.item.minute',
68
- day: 'fineTemplateRepetition.item.day',
69
- item: 'fineTemplateRepetition.item.item',
70
- count: 'fineTemplateRepetition.item.count'
71
- }
72
- },
73
- payedState: {
74
- payed: 'payedState.payed',
75
- notPayed: 'payedState.notPayed'
76
- },
77
- userRole: {
78
- personManager: 'userRole.personManager',
79
- fineTemplateManager: 'userRole.fineTemplateManager',
80
- fineManager: 'userRole.fineManager',
81
- teamManager: 'userRole.teamManager'
82
- }
3
+ exports.Localization = exports.PluralLocalization = exports.ValueLocalization = exports.localizations = void 0;
4
+ const typescript_common_functionality_1 = require("@stevenkellner/typescript-common-functionality");
5
+ const en_1 = require("../locales/en");
6
+ const de_1 = require("../locales/de");
7
+ const Pluralization_1 = require("./Pluralization");
8
+ exports.localizations = {
9
+ en: en_1.localizationEN,
10
+ de: de_1.localizationDE
83
11
  };
84
- exports.localizationNKey = {
85
- fineAmount: {
86
- item: {
87
- type: {
88
- crateOfBeer: 'fineAmount.item.type.crateOfBeer?count=%s',
89
- crateOfBeerWithoutCount: 'fineAmount.item.type.crateOfBeerWithoutCount?count=%s'
90
- }
91
- }
92
- },
93
- fineTemplateRepetition: {
94
- item: {
95
- minute: 'fineTemplateRepetition.item.minute?count=%s',
96
- minuteWithoutCount: 'fineTemplateRepetition.item.minuteWithoutCount?count=%s',
97
- day: 'fineTemplateRepetition.item.day?count=%s',
98
- dayWithoutCount: 'fineTemplateRepetition.item.dayWithoutCount?count=%s',
99
- item: 'fineTemplateRepetition.item.item?count=%s',
100
- itemWithoutCount: 'fineTemplateRepetition.item.itemWithoutCount?count=%s',
101
- count: 'fineTemplateRepetition.item.count?count=%s',
102
- countWithoutCount: 'fineTemplateRepetition.item.countWithoutCount?count=%s'
12
+ class ValueLocalization {
13
+ rawValues;
14
+ constructor(rawValues) {
15
+ this.rawValues = rawValues;
16
+ }
17
+ value(args = {}) {
18
+ let rawValue = this.rawValues[Localization.locale];
19
+ const regex = /\{\{(?<key>.*?)\}\}/;
20
+ while (true) {
21
+ const match = regex.exec(rawValue);
22
+ if (!match)
23
+ break;
24
+ const key = match.groups.key;
25
+ if (!(key in args))
26
+ throw new Error(`Missing argument for key: ${key}`);
27
+ rawValue = rawValue.replace(match[0], args[key]);
103
28
  }
29
+ return rawValue;
104
30
  }
105
- };
106
- class Localization {
107
- static shared = new Localization();
108
- constructor() {
109
- i18n.configure({
110
- locales: Configuration_1.Configuration.Locale.all,
111
- defaultLocale: 'en',
112
- directory: 'src/locales',
113
- objectNotation: true
114
- });
31
+ }
32
+ exports.ValueLocalization = ValueLocalization;
33
+ class PluralLocalization {
34
+ pluralizations;
35
+ constructor(pluralizations) {
36
+ this.pluralizations = pluralizations;
115
37
  }
116
- setLocale(locale) {
117
- i18n.setLocale(locale);
38
+ value(count, args = {}) {
39
+ const valueLocalization = new ValueLocalization((0, typescript_common_functionality_1.mapRecord)(this.pluralizations, pluralization => pluralization.get(count)));
40
+ return valueLocalization.value({
41
+ count: `${count}`,
42
+ ...args
43
+ });
118
44
  }
119
- get(getKey, ...args) {
120
- const key = getKey(exports.localizationKey);
121
- return i18n.__(key, ...args);
45
+ }
46
+ exports.PluralLocalization = PluralLocalization;
47
+ function swap1stAnd2ndLevel(record) {
48
+ const swapped = {};
49
+ for (const key1 of (0, typescript_common_functionality_1.keys)(record)) {
50
+ for (const key2 of (0, typescript_common_functionality_1.keys)(record[key1])) {
51
+ if (!(key2 in swapped))
52
+ swapped[key2] = {};
53
+ swapped[key2][key1] = record[key1][key2];
54
+ }
122
55
  }
123
- getN(getKey, count) {
124
- const key = getKey(exports.localizationNKey);
125
- return i18n.__n(key, count);
56
+ return swapped;
57
+ }
58
+ class Localization {
59
+ static locale = 'en';
60
+ static shared = Localization.getSubLocalization(exports.localizations);
61
+ static getSubLocalization(_localizations) {
62
+ const _localizationValue = (0, typescript_common_functionality_1.values)(_localizations);
63
+ if (_localizationValue.length === 0)
64
+ return {};
65
+ if (typeof _localizationValue[0] === 'object' && !(_localizationValue[0] instanceof Pluralization_1.Pluralization)) {
66
+ const swapped = swap1stAnd2ndLevel(_localizations);
67
+ return (0, typescript_common_functionality_1.mapRecord)(swapped, subLocalization => Localization.getSubLocalization(subLocalization));
68
+ }
69
+ if (typeof _localizationValue[0] === 'string')
70
+ return new ValueLocalization(_localizations);
71
+ if (_localizationValue[0] instanceof Pluralization_1.Pluralization)
72
+ return new PluralLocalization(_localizations);
73
+ throw new Error('Invalid localization structure');
126
74
  }
127
75
  }
128
76
  exports.Localization = Localization;
@@ -7,7 +7,7 @@ var PayedState;
7
7
  (function (PayedState) {
8
8
  PayedState.all = ['payed', 'notPayed'];
9
9
  function formatted(state) {
10
- return Localization_1.Localization.shared.get(key => key.payedState[state]);
10
+ return Localization_1.Localization.shared.payedState[state].value();
11
11
  }
12
12
  PayedState.formatted = formatted;
13
13
  function toggled(state) {
@@ -0,0 +1,17 @@
1
+ export declare class Pluralization {
2
+ private readonly zero;
3
+ private readonly one;
4
+ private readonly two;
5
+ private readonly few;
6
+ private readonly many;
7
+ private readonly other;
8
+ constructor(countLocals: {
9
+ zero?: string;
10
+ one?: string;
11
+ two?: string;
12
+ few?: string;
13
+ many?: string;
14
+ other: string;
15
+ });
16
+ get(count: number): string;
17
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Pluralization = void 0;
4
+ class Pluralization {
5
+ zero;
6
+ one;
7
+ two;
8
+ few;
9
+ many;
10
+ other;
11
+ constructor(countLocals) {
12
+ this.zero = countLocals.zero ?? null;
13
+ this.one = countLocals.one ?? null;
14
+ this.two = countLocals.two ?? null;
15
+ this.few = countLocals.few ?? null;
16
+ this.many = countLocals.many ?? null;
17
+ this.other = countLocals.other;
18
+ }
19
+ get(count) {
20
+ if (count === 0 && this.zero)
21
+ return this.zero;
22
+ else if (count === 1 && this.one)
23
+ return this.one;
24
+ else if (count === 2 && this.two)
25
+ return this.two;
26
+ else if (count > 1 && count < 5 && this.few)
27
+ return this.few;
28
+ else if (count >= 5 && count <= 20 && this.many)
29
+ return this.many;
30
+ return this.other;
31
+ }
32
+ }
33
+ exports.Pluralization = Pluralization;
@@ -18,7 +18,7 @@ var UserRole;
18
18
  'fine-manager': 'fineManager',
19
19
  'team-manager': 'teamManager'
20
20
  };
21
- return Localization_1.Localization.shared.get(key => key.userRole[localizationKeyMap[role]]);
21
+ return Localization_1.Localization.shared.userRole[localizationKeyMap[role]].value();
22
22
  }
23
23
  UserRole.formatted = formatted;
24
24
  UserRole.builder = new typescript_common_functionality_1.ValueTypeBuilder();
@@ -11,6 +11,7 @@ export * from './PayedState';
11
11
  export * from './Person';
12
12
  export * from './PersonPrivateProperties';
13
13
  export * from './PersonSignInProperties';
14
+ export * from './Pluralization';
14
15
  export * from './Team';
15
16
  export * from './User';
16
17
  export * from './UserRole';
@@ -27,6 +27,7 @@ __exportStar(require("./PayedState"), exports);
27
27
  __exportStar(require("./Person"), exports);
28
28
  __exportStar(require("./PersonPrivateProperties"), exports);
29
29
  __exportStar(require("./PersonSignInProperties"), exports);
30
+ __exportStar(require("./Pluralization"), exports);
30
31
  __exportStar(require("./Team"), exports);
31
32
  __exportStar(require("./User"), exports);
32
33
  __exportStar(require("./UserRole"), exports);
@@ -1,12 +1 @@
1
- import { localizationKey, localizationNKey } from '../src/types/Localization';
2
- export declare function localizationWithoutDefault<T extends Record<string, unknown>>(record: T): Exclude<T, 'default'>;
3
1
  export declare function hasSameKeys(record1: Record<string, unknown>, record2: Record<string, unknown>): void;
4
- export declare class TestedKeys {
5
- private tested;
6
- constructor(localization: Record<string, unknown>);
7
- private mapCheckTestedRecord;
8
- checkAllTested(): void;
9
- test(getKey: (key: typeof localizationKey) => string, expected: string): void;
10
- testArgs(getKey: (key: typeof localizationKey) => string, args: string[], expected: string): void;
11
- testN(getKey: (key: typeof localizationNKey) => string, count: number, expected: string): void;
12
- }
@@ -1,16 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TestedKeys = void 0;
4
- exports.localizationWithoutDefault = localizationWithoutDefault;
5
3
  exports.hasSameKeys = hasSameKeys;
6
4
  const core_1 = require("@assertive-ts/core");
7
5
  const typescript_common_functionality_1 = require("@stevenkellner/typescript-common-functionality");
8
- const Localization_1 = require("../src/types/Localization");
9
- function localizationWithoutDefault(record) {
10
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
11
- const { default: _, ...rest } = record;
12
- return rest;
13
- }
6
+ const src_1 = require("../src");
14
7
  function hasSameKeys(record1, record2) {
15
8
  (0, core_1.expect)((0, typescript_common_functionality_1.keys)(record1)).toHaveSameMembers((0, typescript_common_functionality_1.keys)(record2));
16
9
  for (const key of (0, typescript_common_functionality_1.keys)(record1)) {
@@ -18,7 +11,10 @@ function hasSameKeys(record1, record2) {
18
11
  (0, core_1.expect)(record2[key]).not.toBeUndefined();
19
12
  (0, core_1.expect)(typeof record2[key]).toBeEqual('object');
20
13
  (0, core_1.expect)(record1[key]).not.toBeNull();
21
- hasSameKeys(record1[key], record2[key]);
14
+ if (record1[key] instanceof src_1.Pluralization)
15
+ (0, core_1.expect)(record2[key]).toBeInstanceOf(src_1.Pluralization);
16
+ else
17
+ hasSameKeys(record1[key], record2[key]);
22
18
  }
23
19
  else {
24
20
  (0, core_1.expect)(typeof record1[key]).toBeEqual('string');
@@ -26,43 +22,3 @@ function hasSameKeys(record1, record2) {
26
22
  }
27
23
  }
28
24
  }
29
- class TestedKeys {
30
- tested;
31
- constructor(localization) {
32
- this.tested = this.mapCheckTestedRecord(localizationWithoutDefault(localization));
33
- }
34
- mapCheckTestedRecord(record) {
35
- function getKeyList(record, key) {
36
- return (0, typescript_common_functionality_1.keys)(record).flatMap(k => {
37
- if (typeof record[k] === 'object' && record[k] !== null)
38
- return getKeyList(record[k], `${key}${k}.`);
39
- else
40
- return `${key}${k}`;
41
- });
42
- }
43
- const testedRecord = {};
44
- for (const key of getKeyList(record, ''))
45
- testedRecord[key] = false;
46
- return testedRecord;
47
- }
48
- checkAllTested() {
49
- for (const value of (0, typescript_common_functionality_1.values)(this.tested))
50
- (0, core_1.expect)(value).toBeEqual(true);
51
- }
52
- test(getKey, expected) {
53
- this.tested[getKey(Localization_1.localizationKey)] = true;
54
- (0, core_1.expect)(Localization_1.Localization.shared.get(getKey)).toBeEqual(expected);
55
- }
56
- testArgs(getKey, args, expected) {
57
- this.tested[getKey(Localization_1.localizationKey)] = true;
58
- (0, core_1.expect)(Localization_1.Localization.shared.get(getKey, ...args)).toBeEqual(expected);
59
- }
60
- testN(getKey, count, expected) {
61
- if (count === 1)
62
- this.tested[`${getKey(Localization_1.localizationNKey)}.one`] = true;
63
- else
64
- this.tested[`${getKey(Localization_1.localizationNKey)}.other`] = true;
65
- (0, core_1.expect)(Localization_1.Localization.shared.getN(getKey, count)).toBeEqual(expected);
66
- }
67
- }
68
- exports.TestedKeys = TestedKeys;