@stevenkellner/team-conduct-api 1.0.12 → 1.0.14
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/index.ts +1 -4
- package/lib/index.d.ts +1 -4
- package/lib/index.js +1 -4
- package/lib/src/firebaseFunctionsContext.d.ts +1 -14
- package/lib/src/firebaseFunctionsContext.js +19 -36
- package/lib/src/functions/fine/add.js +3 -37
- package/lib/src/functions/fine/delete.js +3 -37
- package/lib/src/functions/fine/update.js +4 -38
- package/lib/src/functions/index.d.ts +18 -0
- package/lib/src/functions/index.js +34 -0
- package/lib/src/index.d.ts +8 -0
- package/lib/src/index.js +24 -0
- package/lib/src/locales/de.json +65 -0
- package/lib/src/locales/en.json +65 -0
- package/lib/src/types/FineAmount.d.ts +2 -1
- package/lib/src/types/FineAmount.js +7 -42
- package/lib/src/types/FineTemplateRepetition.d.ts +2 -0
- package/lib/src/types/FineTemplateRepetition.js +8 -0
- package/lib/src/types/Localization.d.ts +70 -0
- package/lib/src/types/Localization.js +123 -0
- package/lib/src/types/PayedState.d.ts +1 -0
- package/lib/src/types/PayedState.js +5 -0
- package/lib/src/types/UserRole.d.ts +1 -0
- package/lib/src/types/UserRole.js +11 -0
- package/lib/src/types/index.d.ts +1 -0
- package/lib/src/types/index.js +1 -0
- package/lib/test/localization-utils.d.ts +12 -0
- package/lib/test/localization-utils.js +68 -0
- package/lib/test/localization.de.test.d.ts +1 -0
- package/lib/test/localization.de.test.js +162 -0
- package/lib/test/localization.en.test.d.ts +1 -0
- package/lib/test/localization.en.test.js +158 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -1
- package/src/firebaseFunctionsContext.ts +7 -18
- package/src/functions/fine/add.ts +5 -5
- package/src/functions/fine/delete.ts +4 -5
- package/src/functions/fine/update.ts +5 -6
- package/src/functions/index.ts +19 -0
- package/src/index.ts +8 -0
- package/src/locales/de.json +63 -28
- package/src/locales/en.json +49 -14
- package/src/types/FineAmount.ts +7 -9
- package/src/types/FineTemplateRepetition.ts +9 -0
- package/src/types/Localization.ts +94 -0
- package/src/types/PayedState.ts +5 -0
- package/src/types/UserRole.ts +11 -0
- package/src/types/index.ts +1 -0
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FineTemplateRepetition = void 0;
|
|
4
4
|
const typescript_common_functionality_1 = require("@stevenkellner/typescript-common-functionality");
|
|
5
|
+
const Localization_1 = require("./Localization");
|
|
5
6
|
class FineTemplateRepetition {
|
|
6
7
|
item;
|
|
7
8
|
maxCount;
|
|
@@ -9,6 +10,9 @@ class FineTemplateRepetition {
|
|
|
9
10
|
this.item = item;
|
|
10
11
|
this.maxCount = maxCount;
|
|
11
12
|
}
|
|
13
|
+
formatted(count) {
|
|
14
|
+
return Localization_1.Localization.shared.getN(key => key.fineTemplateRepetition.item[this.item], count);
|
|
15
|
+
}
|
|
12
16
|
get flatten() {
|
|
13
17
|
return {
|
|
14
18
|
item: this.item,
|
|
@@ -26,6 +30,10 @@ exports.FineTemplateRepetition = FineTemplateRepetition;
|
|
|
26
30
|
'item',
|
|
27
31
|
'count'
|
|
28
32
|
];
|
|
33
|
+
function formatted(item) {
|
|
34
|
+
return Localization_1.Localization.shared.get(key => key.fineTemplateRepetition.item[item]);
|
|
35
|
+
}
|
|
36
|
+
Item.formatted = formatted;
|
|
29
37
|
Item.builder = new typescript_common_functionality_1.ValueTypeBuilder();
|
|
30
38
|
})(Item = FineTemplateRepetition.Item || (FineTemplateRepetition.Item = {}));
|
|
31
39
|
class TypeBuilder {
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Configuration } from './Configuration';
|
|
2
|
+
export declare const localizationKey: {
|
|
3
|
+
notification: {
|
|
4
|
+
fine: {
|
|
5
|
+
new: {
|
|
6
|
+
title: string;
|
|
7
|
+
body: string;
|
|
8
|
+
};
|
|
9
|
+
reminder: {
|
|
10
|
+
title: string;
|
|
11
|
+
body: string;
|
|
12
|
+
};
|
|
13
|
+
stateChange: {
|
|
14
|
+
title: string;
|
|
15
|
+
bodyPayed: string;
|
|
16
|
+
bodyUnpayed: string;
|
|
17
|
+
bodyDeleted: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
fineAmount: {
|
|
22
|
+
item: {
|
|
23
|
+
type: {
|
|
24
|
+
crateOfBeer: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
fineTemplateRepetition: {
|
|
29
|
+
item: {
|
|
30
|
+
minute: string;
|
|
31
|
+
day: string;
|
|
32
|
+
item: string;
|
|
33
|
+
count: string;
|
|
34
|
+
};
|
|
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
|
+
};
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
fineTemplateRepetition: {
|
|
56
|
+
item: {
|
|
57
|
+
minute: string;
|
|
58
|
+
day: string;
|
|
59
|
+
item: string;
|
|
60
|
+
count: string;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export declare class Localization {
|
|
65
|
+
static readonly shared: Localization;
|
|
66
|
+
private constructor();
|
|
67
|
+
setLocale(locale: Configuration.Locale): void;
|
|
68
|
+
get(getKey: (key: typeof localizationKey) => string, ...args: string[]): string;
|
|
69
|
+
getN(getKey: (key: typeof localizationNKey) => string, count: number): string;
|
|
70
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
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
|
+
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
|
+
}
|
|
83
|
+
};
|
|
84
|
+
exports.localizationNKey = {
|
|
85
|
+
fineAmount: {
|
|
86
|
+
item: {
|
|
87
|
+
type: {
|
|
88
|
+
crateOfBeer: 'fineAmount.item.type.crateOfBeer?count=%s'
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
fineTemplateRepetition: {
|
|
93
|
+
item: {
|
|
94
|
+
minute: 'fineTemplateRepetition.item.minute?count=%s',
|
|
95
|
+
day: 'fineTemplateRepetition.item.day?count=%s',
|
|
96
|
+
item: 'fineTemplateRepetition.item.item?count=%s',
|
|
97
|
+
count: 'fineTemplateRepetition.item.count?count=%s'
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
class Localization {
|
|
102
|
+
static shared = new Localization();
|
|
103
|
+
constructor() {
|
|
104
|
+
i18n.configure({
|
|
105
|
+
locales: Configuration_1.Configuration.Locale.all,
|
|
106
|
+
defaultLocale: 'en',
|
|
107
|
+
directory: 'src/locales',
|
|
108
|
+
objectNotation: true
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
setLocale(locale) {
|
|
112
|
+
i18n.setLocale(locale);
|
|
113
|
+
}
|
|
114
|
+
get(getKey, ...args) {
|
|
115
|
+
const key = getKey(exports.localizationKey);
|
|
116
|
+
return i18n.__(key, ...args);
|
|
117
|
+
}
|
|
118
|
+
getN(getKey, count) {
|
|
119
|
+
const key = getKey(exports.localizationNKey);
|
|
120
|
+
return i18n.__n(key, count);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
exports.Localization = Localization;
|
|
@@ -2,5 +2,6 @@ import { ValueTypeBuilder } from '@stevenkellner/typescript-common-functionality
|
|
|
2
2
|
export type PayedState = 'payed' | 'notPayed';
|
|
3
3
|
export declare namespace PayedState {
|
|
4
4
|
const all: PayedState[];
|
|
5
|
+
function formatted(state: PayedState): string;
|
|
5
6
|
const builder: ValueTypeBuilder<PayedState>;
|
|
6
7
|
}
|
|
@@ -2,8 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PayedState = void 0;
|
|
4
4
|
const typescript_common_functionality_1 = require("@stevenkellner/typescript-common-functionality");
|
|
5
|
+
const Localization_1 = require("./Localization");
|
|
5
6
|
var PayedState;
|
|
6
7
|
(function (PayedState) {
|
|
7
8
|
PayedState.all = ['payed', 'notPayed'];
|
|
9
|
+
function formatted(state) {
|
|
10
|
+
return Localization_1.Localization.shared.get(key => key.payedState[state]);
|
|
11
|
+
}
|
|
12
|
+
PayedState.formatted = formatted;
|
|
8
13
|
PayedState.builder = new typescript_common_functionality_1.ValueTypeBuilder();
|
|
9
14
|
})(PayedState || (exports.PayedState = PayedState = {}));
|
|
@@ -2,5 +2,6 @@ import { ValueTypeBuilder } from '@stevenkellner/typescript-common-functionality
|
|
|
2
2
|
export type UserRole = 'person-manager' | 'fineTemplate-manager' | 'fine-manager' | 'team-manager';
|
|
3
3
|
export declare namespace UserRole {
|
|
4
4
|
const all: UserRole[];
|
|
5
|
+
function formatted(role: UserRole): string;
|
|
5
6
|
const builder: ValueTypeBuilder<UserRole>;
|
|
6
7
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UserRole = void 0;
|
|
4
4
|
const typescript_common_functionality_1 = require("@stevenkellner/typescript-common-functionality");
|
|
5
|
+
const Localization_1 = require("./Localization");
|
|
5
6
|
var UserRole;
|
|
6
7
|
(function (UserRole) {
|
|
7
8
|
UserRole.all = [
|
|
@@ -10,5 +11,15 @@ var UserRole;
|
|
|
10
11
|
'fine-manager',
|
|
11
12
|
'team-manager'
|
|
12
13
|
];
|
|
14
|
+
function formatted(role) {
|
|
15
|
+
const localizationKeyMap = {
|
|
16
|
+
'person-manager': 'personManager',
|
|
17
|
+
'fineTemplate-manager': 'fineTemplateManager',
|
|
18
|
+
'fine-manager': 'fineManager',
|
|
19
|
+
'team-manager': 'teamManager'
|
|
20
|
+
};
|
|
21
|
+
return Localization_1.Localization.shared.get(key => key.userRole[localizationKeyMap[role]]);
|
|
22
|
+
}
|
|
23
|
+
UserRole.formatted = formatted;
|
|
13
24
|
UserRole.builder = new typescript_common_functionality_1.ValueTypeBuilder();
|
|
14
25
|
})(UserRole || (exports.UserRole = UserRole = {}));
|
package/lib/src/types/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from './FineAmount';
|
|
|
4
4
|
export * from './FineTemplate';
|
|
5
5
|
export * from './FineTemplateRepetition';
|
|
6
6
|
export * from './Invitation';
|
|
7
|
+
export * from './Localization';
|
|
7
8
|
export * from './MoneyAmount';
|
|
8
9
|
export * from './NotificationProperties';
|
|
9
10
|
export * from './PayedState';
|
package/lib/src/types/index.js
CHANGED
|
@@ -20,6 +20,7 @@ __exportStar(require("./FineAmount"), exports);
|
|
|
20
20
|
__exportStar(require("./FineTemplate"), exports);
|
|
21
21
|
__exportStar(require("./FineTemplateRepetition"), exports);
|
|
22
22
|
__exportStar(require("./Invitation"), exports);
|
|
23
|
+
__exportStar(require("./Localization"), exports);
|
|
23
24
|
__exportStar(require("./MoneyAmount"), exports);
|
|
24
25
|
__exportStar(require("./NotificationProperties"), exports);
|
|
25
26
|
__exportStar(require("./PayedState"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { localizationKey, localizationNKey } from '../src/types/Localization';
|
|
2
|
+
export declare function localizationWithoutDefault<T extends Record<string, unknown>>(record: T): Exclude<T, 'default'>;
|
|
3
|
+
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
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TestedKeys = void 0;
|
|
4
|
+
exports.localizationWithoutDefault = localizationWithoutDefault;
|
|
5
|
+
exports.hasSameKeys = hasSameKeys;
|
|
6
|
+
const core_1 = require("@assertive-ts/core");
|
|
7
|
+
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
|
+
}
|
|
14
|
+
function hasSameKeys(record1, record2) {
|
|
15
|
+
(0, core_1.expect)((0, typescript_common_functionality_1.keys)(record1)).toHaveSameMembers((0, typescript_common_functionality_1.keys)(record2));
|
|
16
|
+
for (const key of (0, typescript_common_functionality_1.keys)(record1)) {
|
|
17
|
+
if (typeof record1[key] === 'object' && record1[key] !== null) {
|
|
18
|
+
(0, core_1.expect)(record2[key]).not.toBeUndefined();
|
|
19
|
+
(0, core_1.expect)(typeof record2[key]).toBeEqual('object');
|
|
20
|
+
(0, core_1.expect)(record1[key]).not.toBeNull();
|
|
21
|
+
hasSameKeys(record1[key], record2[key]);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
(0, core_1.expect)(typeof record1[key]).toBeEqual('string');
|
|
25
|
+
(0, core_1.expect)(typeof record2[key]).toBeEqual('string');
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,162 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const core_1 = require("@assertive-ts/core");
|
|
37
|
+
const localizationEN = __importStar(require("../src/locales/en.json"));
|
|
38
|
+
const localizationDE = __importStar(require("../src/locales/de.json"));
|
|
39
|
+
const types_1 = require("../src/types");
|
|
40
|
+
const localization_utils_1 = require("./localization-utils");
|
|
41
|
+
describe('Localization for de', () => {
|
|
42
|
+
const testedKeys = new localization_utils_1.TestedKeys((0, localization_utils_1.localizationWithoutDefault)(localizationDE));
|
|
43
|
+
before(() => {
|
|
44
|
+
types_1.Localization.shared.setLocale('de');
|
|
45
|
+
});
|
|
46
|
+
after('all values should be tested', () => {
|
|
47
|
+
testedKeys.checkAllTested();
|
|
48
|
+
});
|
|
49
|
+
it('should have the same keys as en', () => {
|
|
50
|
+
(0, localization_utils_1.hasSameKeys)((0, localization_utils_1.localizationWithoutDefault)(localizationDE), (0, localization_utils_1.localizationWithoutDefault)(localizationEN));
|
|
51
|
+
});
|
|
52
|
+
describe('notification.fine should be tested', () => {
|
|
53
|
+
it('notification.fine.new should be tested', () => {
|
|
54
|
+
testedKeys.testArgs(key => key.notification.fine.new.title, ['fine-reason'], 'fine-reason');
|
|
55
|
+
testedKeys.testArgs(key => key.notification.fine.new.body, ['10,50 €'], 'Du hast eine neue Strafe von 10,50 €. Bitte so schnell wie möglich zahlen.');
|
|
56
|
+
});
|
|
57
|
+
it('notification.fine.reminder should be tested', () => {
|
|
58
|
+
testedKeys.test(key => key.notification.fine.reminder.title, 'Du hast noch offene Strafen');
|
|
59
|
+
testedKeys.testArgs(key => key.notification.fine.reminder.body, ['10,50 €'], 'Bei dir sind noch 10,50 € offen. Bitte so schnell wie möglich zahlen.');
|
|
60
|
+
});
|
|
61
|
+
it('notification.fine.stateChange should be tested', () => {
|
|
62
|
+
testedKeys.test(key => key.notification.fine.stateChange.title, 'Eine deiner Strafen hat sich geändert');
|
|
63
|
+
testedKeys.testArgs(key => key.notification.fine.stateChange.bodyPayed, ['10,50 €', 'fine-reason'], 'Du hast eine Strafe von 10,50 € bezahlt (fine-reason).');
|
|
64
|
+
testedKeys.testArgs(key => key.notification.fine.stateChange.bodyUnpayed, ['10,50 €', 'fine-reason'], '10,50 €, fine-reason ist noch offen.');
|
|
65
|
+
testedKeys.testArgs(key => key.notification.fine.stateChange.bodyDeleted, ['10,50 €', 'fine-reason'], '10,50 €, fine-reason wurde gelöscht.');
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
describe('fineAmount should be tested', () => {
|
|
69
|
+
it('fineAmount.item.type.crateOfBeer should be tested', () => {
|
|
70
|
+
testedKeys.test(key => key.fineAmount.item.type.crateOfBeer, 'Kasten Bier');
|
|
71
|
+
testedKeys.testN(key => key.fineAmount.item.type.crateOfBeer, 1, 'Ein Kasten Bier');
|
|
72
|
+
testedKeys.testN(key => key.fineAmount.item.type.crateOfBeer, 4, '4 Kästen Bier');
|
|
73
|
+
});
|
|
74
|
+
it('fineAmount.item.type.crateOfBeer should be formatted correctly', () => {
|
|
75
|
+
(0, core_1.expect)(types_1.FineAmount.Item.Type.formatted('crateOfBeer')).toBeEqual('Kasten Bier');
|
|
76
|
+
(0, core_1.expect)(new types_1.FineAmount.Item('crateOfBeer', 1).formatted()).toBeEqual('Ein Kasten Bier');
|
|
77
|
+
(0, core_1.expect)(new types_1.FineAmount.Item('crateOfBeer', 4).formatted()).toBeEqual('4 Kästen Bier');
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
describe('fineTemplateRepetition should be tested', () => {
|
|
81
|
+
it('fineTemplateRepetition.item.minute should be tested', () => {
|
|
82
|
+
testedKeys.test(key => key.fineTemplateRepetition.item.minute, 'Minute');
|
|
83
|
+
testedKeys.testN(key => key.fineTemplateRepetition.item.minute, 1, '1 Minute');
|
|
84
|
+
testedKeys.testN(key => key.fineTemplateRepetition.item.minute, 4, '4 Minuten');
|
|
85
|
+
});
|
|
86
|
+
it('fineTemplateRepetition.item.minute should be formatted correctly', () => {
|
|
87
|
+
(0, core_1.expect)(types_1.FineTemplateRepetition.Item.formatted('minute')).toBeEqual('Minute');
|
|
88
|
+
(0, core_1.expect)(new types_1.FineTemplateRepetition('minute', null).formatted(1)).toBeEqual('1 Minute');
|
|
89
|
+
(0, core_1.expect)(new types_1.FineTemplateRepetition('minute', null).formatted(4)).toBeEqual('4 Minuten');
|
|
90
|
+
});
|
|
91
|
+
it('fineTemplateRepetition.item.day should be tested', () => {
|
|
92
|
+
testedKeys.test(key => key.fineTemplateRepetition.item.day, 'Tag');
|
|
93
|
+
testedKeys.testN(key => key.fineTemplateRepetition.item.day, 1, '1 Tag');
|
|
94
|
+
testedKeys.testN(key => key.fineTemplateRepetition.item.day, 4, '4 Tage');
|
|
95
|
+
});
|
|
96
|
+
it('fineTemplateRepetition.item.day should be formatted correctly', () => {
|
|
97
|
+
(0, core_1.expect)(types_1.FineTemplateRepetition.Item.formatted('day')).toBeEqual('Tag');
|
|
98
|
+
(0, core_1.expect)(new types_1.FineTemplateRepetition('day', null).formatted(1)).toBeEqual('1 Tag');
|
|
99
|
+
(0, core_1.expect)(new types_1.FineTemplateRepetition('day', null).formatted(4)).toBeEqual('4 Tage');
|
|
100
|
+
});
|
|
101
|
+
it('fineTemplateRepetition.item.item should be tested', () => {
|
|
102
|
+
testedKeys.test(key => key.fineTemplateRepetition.item.item, 'Teil');
|
|
103
|
+
testedKeys.testN(key => key.fineTemplateRepetition.item.item, 1, '1 Teil');
|
|
104
|
+
testedKeys.testN(key => key.fineTemplateRepetition.item.item, 4, '4 Teile');
|
|
105
|
+
});
|
|
106
|
+
it('fineTemplateRepetition.item.item should be formatted correctly', () => {
|
|
107
|
+
(0, core_1.expect)(types_1.FineTemplateRepetition.Item.formatted('item')).toBeEqual('Teil');
|
|
108
|
+
(0, core_1.expect)(new types_1.FineTemplateRepetition('item', null).formatted(1)).toBeEqual('1 Teil');
|
|
109
|
+
(0, core_1.expect)(new types_1.FineTemplateRepetition('item', null).formatted(4)).toBeEqual('4 Teile');
|
|
110
|
+
});
|
|
111
|
+
it('fineTemplateRepetition.item.count should be tested', () => {
|
|
112
|
+
testedKeys.test(key => key.fineTemplateRepetition.item.count, 'Anzahl');
|
|
113
|
+
testedKeys.testN(key => key.fineTemplateRepetition.item.count, 1, '1 mal');
|
|
114
|
+
testedKeys.testN(key => key.fineTemplateRepetition.item.count, 4, '4 mal');
|
|
115
|
+
});
|
|
116
|
+
it('fineTemplateRepetition.item.count should be formatted correctly', () => {
|
|
117
|
+
(0, core_1.expect)(types_1.FineTemplateRepetition.Item.formatted('count')).toBeEqual('Anzahl');
|
|
118
|
+
(0, core_1.expect)(new types_1.FineTemplateRepetition('count', null).formatted(1)).toBeEqual('1 mal');
|
|
119
|
+
(0, core_1.expect)(new types_1.FineTemplateRepetition('count', null).formatted(4)).toBeEqual('4 mal');
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
describe('payedState should be tested', () => {
|
|
123
|
+
it('payedState.payed should be tested', () => {
|
|
124
|
+
testedKeys.test(key => key.payedState.payed, 'Bezahlt');
|
|
125
|
+
});
|
|
126
|
+
it('payedState.payed should be formatted correctly', () => {
|
|
127
|
+
(0, core_1.expect)(types_1.PayedState.formatted('payed')).toBeEqual('Bezahlt');
|
|
128
|
+
});
|
|
129
|
+
it('payedState.notPayed should be tested', () => {
|
|
130
|
+
testedKeys.test(key => key.payedState.notPayed, 'Offen');
|
|
131
|
+
});
|
|
132
|
+
it('payedState.notPayed should be formatted correctly', () => {
|
|
133
|
+
(0, core_1.expect)(types_1.PayedState.formatted('notPayed')).toBeEqual('Offen');
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
describe('userRole should be tested', () => {
|
|
137
|
+
it('userRole.personManager should be tested', () => {
|
|
138
|
+
testedKeys.test(key => key.userRole.personManager, 'Personenmanager');
|
|
139
|
+
});
|
|
140
|
+
it('userRole.personManager should be formatted correctly', () => {
|
|
141
|
+
(0, core_1.expect)(types_1.UserRole.formatted('person-manager')).toBeEqual('Personenmanager');
|
|
142
|
+
});
|
|
143
|
+
it('userRole.fineTemplateManager should be tested', () => {
|
|
144
|
+
testedKeys.test(key => key.userRole.fineTemplateManager, 'Strafvorlagenmanager');
|
|
145
|
+
});
|
|
146
|
+
it('userRole.fineTemplateManager should be formatted correctly', () => {
|
|
147
|
+
(0, core_1.expect)(types_1.UserRole.formatted('fineTemplate-manager')).toBeEqual('Strafvorlagenmanager');
|
|
148
|
+
});
|
|
149
|
+
it('userRole.fineManager should be tested', () => {
|
|
150
|
+
testedKeys.test(key => key.userRole.fineManager, 'Strafenmanager');
|
|
151
|
+
});
|
|
152
|
+
it('userRole.fineManager should be formatted correctly', () => {
|
|
153
|
+
(0, core_1.expect)(types_1.UserRole.formatted('fine-manager')).toBeEqual('Strafenmanager');
|
|
154
|
+
});
|
|
155
|
+
it('userRole.teamManager should be tested', () => {
|
|
156
|
+
testedKeys.test(key => key.userRole.teamManager, 'Teammanager');
|
|
157
|
+
});
|
|
158
|
+
it('userRole.teamManager should be formatted correctly', () => {
|
|
159
|
+
(0, core_1.expect)(types_1.UserRole.formatted('team-manager')).toBeEqual('Teammanager');
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|