@stevenkellner/team-conduct-api 1.0.35 → 2.0.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.
Files changed (218) hide show
  1. package/lib/src/firebase/FirebaseConfiguration.d.ts +45 -1
  2. package/lib/src/firebase/FirebaseConfiguration.js +44 -0
  3. package/lib/src/firebase/Firestore.d.ts +196 -0
  4. package/lib/src/firebase/Firestore.js +235 -0
  5. package/lib/src/{FirestoreScheme.d.ts → firebase/FirestoreScheme.d.ts} +15 -1
  6. package/lib/src/firebase/Messaging.d.ts +64 -0
  7. package/lib/src/firebase/checkAuthentication.d.ts +37 -0
  8. package/lib/src/{checkAuthentication.js → firebase/checkAuthentication.js} +26 -1
  9. package/lib/src/firebase/index.d.ts +4 -0
  10. package/lib/src/firebase/index.js +4 -0
  11. package/lib/src/firebase/pushNotification.d.ts +39 -0
  12. package/lib/src/firebase/pushNotification.js +88 -0
  13. package/lib/src/functions/fine/add.d.ts +10 -13
  14. package/lib/src/functions/fine/add.js +3 -30
  15. package/lib/src/functions/fine/delete.d.ts +10 -13
  16. package/lib/src/functions/fine/delete.js +3 -27
  17. package/lib/src/functions/fine/update.d.ts +10 -13
  18. package/lib/src/functions/fine/update.js +3 -28
  19. package/lib/src/functions/fineTemplate/add.d.ts +6 -9
  20. package/lib/src/functions/fineTemplate/add.js +3 -12
  21. package/lib/src/functions/fineTemplate/delete.d.ts +6 -9
  22. package/lib/src/functions/fineTemplate/delete.js +3 -12
  23. package/lib/src/functions/fineTemplate/update.d.ts +6 -9
  24. package/lib/src/functions/fineTemplate/update.js +3 -12
  25. package/lib/src/functions/invitation/getInvitation.d.ts +41 -42
  26. package/lib/src/functions/invitation/getInvitation.js +58 -81
  27. package/lib/src/functions/invitation/invite.d.ts +1 -2
  28. package/lib/src/functions/invitation/invite.js +3 -18
  29. package/lib/src/functions/invitation/register.d.ts +6 -11
  30. package/lib/src/functions/invitation/register.js +3 -39
  31. package/lib/src/functions/invitation/withdraw.d.ts +1 -2
  32. package/lib/src/functions/invitation/withdraw.js +3 -13
  33. package/lib/src/functions/notification/register.d.ts +7 -10
  34. package/lib/src/functions/notification/register.js +3 -15
  35. package/lib/src/functions/notification/subscribe.d.ts +8 -11
  36. package/lib/src/functions/notification/subscribe.js +3 -14
  37. package/lib/src/functions/paypalMe/edit.d.ts +6 -9
  38. package/lib/src/functions/paypalMe/edit.js +3 -14
  39. package/lib/src/functions/person/add.d.ts +7 -10
  40. package/lib/src/functions/person/add.js +3 -12
  41. package/lib/src/functions/person/delete.d.ts +6 -9
  42. package/lib/src/functions/person/delete.js +3 -14
  43. package/lib/src/functions/person/update.d.ts +7 -10
  44. package/lib/src/functions/person/update.js +3 -13
  45. package/lib/src/functions/team/new.d.ts +9 -12
  46. package/lib/src/functions/team/new.js +3 -22
  47. package/lib/src/functions/user/kickout.d.ts +6 -9
  48. package/lib/src/functions/user/kickout.js +3 -25
  49. package/lib/src/functions/user/login.d.ts +1 -2
  50. package/lib/src/functions/user/login.js +3 -13
  51. package/lib/src/functions/user/roleEdit.d.ts +8 -11
  52. package/lib/src/functions/user/roleEdit.js +3 -18
  53. package/lib/src/index.d.ts +0 -5
  54. package/lib/src/index.js +0 -5
  55. package/lib/src/locales/de.d.ts +10 -67
  56. package/lib/src/locales/de.js +8 -0
  57. package/lib/src/locales/en.d.ts +10 -0
  58. package/lib/src/locales/en.js +19 -2
  59. package/lib/src/types/Configuration.d.ts +33 -15
  60. package/lib/src/types/Configuration.js +24 -12
  61. package/lib/src/types/Currency.d.ts +20 -0
  62. package/lib/src/types/Currency.js +19 -0
  63. package/lib/src/types/Fine.d.ts +41 -0
  64. package/lib/src/types/Fine.js +32 -0
  65. package/lib/src/types/FineAmount.d.ts +160 -9
  66. package/lib/src/types/FineAmount.js +128 -7
  67. package/lib/src/types/FineTemplate.d.ts +41 -0
  68. package/lib/src/types/FineTemplate.js +32 -0
  69. package/lib/src/types/FineTemplateRepetition.d.ts +72 -10
  70. package/lib/src/types/FineTemplateRepetition.js +66 -12
  71. package/lib/src/types/Invitation.d.ts +48 -0
  72. package/lib/src/types/Invitation.js +39 -0
  73. package/lib/src/types/Locale.d.ts +16 -0
  74. package/lib/src/types/Locale.js +16 -0
  75. package/lib/src/types/Localization.d.ts +74 -74
  76. package/lib/src/types/Localization.js +80 -41
  77. package/lib/src/types/MoneyAmount.d.ts +67 -1
  78. package/lib/src/types/MoneyAmount.js +62 -0
  79. package/lib/src/types/NotificationProperties.d.ts +70 -9
  80. package/lib/src/types/NotificationProperties.js +49 -5
  81. package/lib/src/types/PayedState.d.ts +25 -9
  82. package/lib/src/types/PayedState.js +17 -27
  83. package/lib/src/types/Person.d.ts +45 -0
  84. package/lib/src/types/Person.js +36 -0
  85. package/lib/src/types/PersonPrivateProperties.d.ts +28 -0
  86. package/lib/src/types/PersonPrivateProperties.js +25 -0
  87. package/lib/src/types/PersonSignInProperties.d.ts +30 -0
  88. package/lib/src/types/PersonSignInProperties.js +27 -0
  89. package/lib/src/types/Pluralization.d.ts +46 -0
  90. package/lib/src/types/Pluralization.js +46 -0
  91. package/lib/src/types/Team.d.ts +38 -0
  92. package/lib/src/types/Team.js +29 -0
  93. package/lib/src/types/User.d.ts +68 -3
  94. package/lib/src/types/User.js +59 -5
  95. package/lib/src/types/UserRole.d.ts +26 -4
  96. package/lib/src/types/UserRole.js +25 -9
  97. package/lib/src/types/index.d.ts +2 -0
  98. package/lib/src/types/index.js +2 -0
  99. package/lib/test/firebase/FirebaseConfiguration.test.js +155 -0
  100. package/lib/test/firebase/Firestore.test.js +46 -0
  101. package/lib/test/firebase/checkAuthentication.test.d.ts +1 -0
  102. package/lib/test/firebase/checkAuthentication.test.js +305 -0
  103. package/lib/test/firebase/firebase-utils.d.ts +32 -0
  104. package/lib/test/firebase/firebase-utils.js +131 -0
  105. package/lib/test/firebase/pushNotification.test.d.ts +1 -0
  106. package/lib/test/firebase/pushNotification.test.js +300 -0
  107. package/lib/test/locales/localization.de.test.d.ts +1 -0
  108. package/lib/test/locales/localization.de.test.js +144 -0
  109. package/lib/test/locales/localization.en.test.d.ts +1 -0
  110. package/lib/test/locales/localization.en.test.js +144 -0
  111. package/lib/test/types/Configuration.test.d.ts +1 -0
  112. package/lib/test/types/Configuration.test.js +84 -0
  113. package/lib/test/types/Currency.test.d.ts +1 -0
  114. package/lib/test/types/Currency.test.js +41 -0
  115. package/lib/test/types/Fine.test.d.ts +1 -0
  116. package/lib/test/types/Fine.test.js +265 -0
  117. package/lib/test/types/FineAmount.test.d.ts +1 -0
  118. package/lib/test/types/FineAmount.test.js +445 -0
  119. package/lib/test/types/FineTemplate.test.d.ts +1 -0
  120. package/lib/test/types/FineTemplate.test.js +271 -0
  121. package/lib/test/types/FineTemplateRepetition.test.d.ts +1 -0
  122. package/lib/test/types/FineTemplateRepetition.test.js +361 -0
  123. package/lib/test/types/Invitation.test.d.ts +1 -0
  124. package/lib/test/types/Invitation.test.js +269 -0
  125. package/lib/test/types/Locale.test.d.ts +1 -0
  126. package/lib/test/types/Locale.test.js +46 -0
  127. package/lib/test/types/Localization.test.d.ts +1 -0
  128. package/lib/test/types/Localization.test.js +241 -0
  129. package/lib/test/types/MoneyAmount.test.d.ts +1 -0
  130. package/lib/test/types/MoneyAmount.test.js +276 -0
  131. package/lib/test/types/NotificationProperties.test.d.ts +1 -0
  132. package/lib/test/types/NotificationProperties.test.js +258 -0
  133. package/lib/test/types/PayedState.test.d.ts +1 -0
  134. package/lib/test/types/PayedState.test.js +105 -0
  135. package/lib/test/types/Person.test.d.ts +1 -0
  136. package/lib/test/types/Person.test.js +266 -0
  137. package/lib/test/types/PersonPrivateProperties.test.d.ts +1 -0
  138. package/lib/test/types/PersonPrivateProperties.test.js +155 -0
  139. package/lib/test/types/PersonSignInProperties.test.d.ts +1 -0
  140. package/lib/test/types/PersonSignInProperties.test.js +208 -0
  141. package/lib/test/types/Pluralization.test.d.ts +1 -0
  142. package/lib/test/types/Pluralization.test.js +206 -0
  143. package/lib/test/types/Team.test.d.ts +1 -0
  144. package/lib/test/types/Team.test.js +145 -0
  145. package/lib/test/types/User.test.d.ts +1 -0
  146. package/lib/test/types/User.test.js +232 -0
  147. package/lib/test/types/UserRole.test.d.ts +1 -0
  148. package/lib/test/types/UserRole.test.js +140 -0
  149. package/lib/tsconfig.tsbuildinfo +1 -1
  150. package/package.json +10 -9
  151. package/src/firebase/FirebaseConfiguration.ts +49 -1
  152. package/src/firebase/Firestore.ts +248 -0
  153. package/src/{FirestoreScheme.ts → firebase/FirestoreScheme.ts} +15 -1
  154. package/src/firebase/Messaging.ts +64 -0
  155. package/src/{checkAuthentication.ts → firebase/checkAuthentication.ts} +39 -1
  156. package/src/firebase/index.ts +5 -0
  157. package/src/firebase/pushNotification.ts +90 -0
  158. package/src/functions/fine/add.ts +10 -48
  159. package/src/functions/fine/delete.ts +9 -43
  160. package/src/functions/fine/update.ts +10 -44
  161. package/src/functions/fineTemplate/add.ts +7 -23
  162. package/src/functions/fineTemplate/delete.ts +7 -23
  163. package/src/functions/fineTemplate/update.ts +7 -24
  164. package/src/functions/index.ts +0 -1
  165. package/src/functions/invitation/getInvitation.ts +83 -109
  166. package/src/functions/invitation/invite.ts +2 -25
  167. package/src/functions/invitation/register.ts +9 -60
  168. package/src/functions/invitation/withdraw.ts +2 -16
  169. package/src/functions/notification/register.ts +7 -26
  170. package/src/functions/notification/subscribe.ts +8 -26
  171. package/src/functions/paypalMe/edit.ts +7 -25
  172. package/src/functions/person/add.ts +8 -24
  173. package/src/functions/person/delete.ts +6 -25
  174. package/src/functions/person/update.ts +8 -25
  175. package/src/functions/team/new.ts +12 -42
  176. package/src/functions/user/kickout.ts +8 -41
  177. package/src/functions/user/login.ts +2 -16
  178. package/src/functions/user/roleEdit.ts +8 -32
  179. package/src/index.ts +0 -5
  180. package/src/locales/de.ts +10 -1
  181. package/src/locales/en.ts +21 -2
  182. package/src/types/Configuration.ts +33 -23
  183. package/src/types/Currency.ts +24 -0
  184. package/src/types/Fine.ts +41 -0
  185. package/src/types/FineAmount.ts +162 -11
  186. package/src/types/FineTemplate.ts +41 -0
  187. package/src/types/FineTemplateRepetition.ts +75 -17
  188. package/src/types/Invitation.ts +48 -0
  189. package/src/types/Locale.ts +20 -0
  190. package/src/types/Localization.ts +96 -41
  191. package/src/types/MoneyAmount.ts +67 -1
  192. package/src/types/NotificationProperties.ts +67 -9
  193. package/src/types/PayedState.ts +25 -30
  194. package/src/types/Person.ts +45 -0
  195. package/src/types/PersonPrivateProperties.ts +28 -1
  196. package/src/types/PersonSignInProperties.ts +30 -0
  197. package/src/types/Pluralization.ts +46 -0
  198. package/src/types/Team.ts +38 -0
  199. package/src/types/User.ts +70 -4
  200. package/src/types/UserRole.ts +32 -16
  201. package/src/types/index.ts +2 -0
  202. package/lib/src/Firestore.d.ts +0 -24
  203. package/lib/src/Firestore.js +0 -62
  204. package/lib/src/checkAuthentication.d.ts +0 -6
  205. package/lib/src/firebaseFunctionsContext.d.ts +0 -39
  206. package/lib/src/firebaseFunctionsContext.js +0 -43
  207. package/lib/src/pushNotification.d.ts +0 -3
  208. package/lib/src/pushNotification.js +0 -35
  209. package/lib/test/localization-utils.d.ts +0 -1
  210. package/lib/test/localization-utils.js +0 -24
  211. package/lib/test/localization.de.test.js +0 -151
  212. package/lib/test/localization.en.test.js +0 -145
  213. package/src/Firestore.ts +0 -75
  214. package/src/firebaseFunctionsContext.ts +0 -48
  215. package/src/pushNotification.ts +0 -37
  216. /package/lib/src/{FirestoreScheme.js → firebase/FirestoreScheme.js} +0 -0
  217. /package/lib/test/{localization.de.test.d.ts → firebase/FirebaseConfiguration.test.d.ts} +0 -0
  218. /package/lib/test/{localization.en.test.d.ts → firebase/Firestore.test.d.ts} +0 -0
@@ -0,0 +1,300 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const mocha_1 = require("mocha");
4
+ const core_1 = require("@assertive-ts/core");
5
+ const pushNotification_1 = require("../../src/firebase/pushNotification");
6
+ const index_1 = require("../../src/types/index");
7
+ const typescript_common_functionality_1 = require("@stevenkellner/typescript-common-functionality");
8
+ const firebase_utils_1 = require("./firebase-utils");
9
+ const src_1 = require("../../src");
10
+ (0, mocha_1.describe)('pushNotification', () => {
11
+ const teamId = index_1.Team.Id.builder.build(typescript_common_functionality_1.Guid.generate().guidString);
12
+ const personId = index_1.Person.Id.builder.build(typescript_common_functionality_1.Guid.generate().guidString);
13
+ (0, mocha_1.describe)('person does not exist', () => {
14
+ (0, mocha_1.it)('should return without error when person does not exist', async () => {
15
+ (0, firebase_utils_1.configureFirebase)({
16
+ teams: firebase_utils_1.Collection.docs({
17
+ [teamId.guidString]: firebase_utils_1.Document.colls({
18
+ persons: firebase_utils_1.Collection.docs({
19
+ [personId.guidString]: firebase_utils_1.Document.empty()
20
+ })
21
+ })
22
+ })
23
+ });
24
+ await (0, pushNotification_1.pushNotification)(teamId, personId, 'new-fine', {
25
+ title: 'Test Notification',
26
+ body: 'Test Body'
27
+ });
28
+ });
29
+ });
30
+ (0, mocha_1.describe)('person is not signed in', () => {
31
+ (0, mocha_1.it)('should return without sending when signInProperties is null', async () => {
32
+ (0, firebase_utils_1.configureFirebase)({
33
+ teams: firebase_utils_1.Collection.docs({
34
+ [teamId.guidString]: firebase_utils_1.Document.colls({
35
+ persons: firebase_utils_1.Collection.docs({
36
+ [personId.guidString]: firebase_utils_1.Document.personNotSignedIn(personId)
37
+ })
38
+ })
39
+ })
40
+ });
41
+ await (0, pushNotification_1.pushNotification)(teamId, personId, 'new-fine', {
42
+ title: 'Test Notification',
43
+ body: 'Test Body'
44
+ });
45
+ });
46
+ });
47
+ (0, mocha_1.describe)('person is not subscribed to topic', () => {
48
+ (0, mocha_1.it)('should return without sending when person is not subscribed', async () => {
49
+ (0, firebase_utils_1.configureFirebase)({
50
+ teams: firebase_utils_1.Collection.docs({
51
+ [teamId.guidString]: firebase_utils_1.Document.colls({
52
+ persons: firebase_utils_1.Collection.docs({
53
+ [personId.guidString]: firebase_utils_1.Document.personWithSubscriptions(personId, ['fine-reminder'])
54
+ })
55
+ })
56
+ })
57
+ });
58
+ await (0, pushNotification_1.pushNotification)(teamId, personId, 'new-fine', {
59
+ title: 'Test Notification',
60
+ body: 'Test Body'
61
+ });
62
+ });
63
+ });
64
+ (0, mocha_1.describe)('successful notification', () => {
65
+ (0, mocha_1.it)('should send notification to subscribed person with tokens', async () => {
66
+ const tokens = new typescript_common_functionality_1.Dictionary(index_1.NotificationProperties.TokenId.builder);
67
+ tokens.set(index_1.NotificationProperties.TokenId.create('device-token-1'), 'device-token-1');
68
+ tokens.set(index_1.NotificationProperties.TokenId.create('device-token-2'), 'device-token-2');
69
+ let messagingCalled = false;
70
+ (0, firebase_utils_1.configureFirebase)({
71
+ teams: firebase_utils_1.Collection.docs({
72
+ [teamId.guidString]: firebase_utils_1.Document.colls({
73
+ persons: firebase_utils_1.Collection.docs({
74
+ [personId.guidString]: firebase_utils_1.Document.personWithSubscriptions(personId, ['new-fine', 'fine-reminder'], tokens)
75
+ })
76
+ })
77
+ })
78
+ }, {
79
+ sendEachForMulticast: async (message) => {
80
+ messagingCalled = true;
81
+ return {
82
+ responses: message.tokens.map(token => ({
83
+ success: true,
84
+ messageId: `msg-${token}`
85
+ })),
86
+ successCount: message.tokens.length,
87
+ failureCount: 0
88
+ };
89
+ }
90
+ });
91
+ await (0, pushNotification_1.pushNotification)(teamId, personId, 'new-fine', {
92
+ title: 'New Fine',
93
+ body: 'You have received a new fine'
94
+ });
95
+ (0, core_1.expect)(messagingCalled).toBeTrue();
96
+ });
97
+ (0, mocha_1.it)('should send notification for different subscription topics', async () => {
98
+ const tokens = new typescript_common_functionality_1.Dictionary(index_1.NotificationProperties.TokenId.builder);
99
+ tokens.set(index_1.NotificationProperties.TokenId.create('device-token-1'), 'device-token-1');
100
+ let messagingCalled = false;
101
+ (0, firebase_utils_1.configureFirebase)({
102
+ teams: firebase_utils_1.Collection.docs({
103
+ [teamId.guidString]: firebase_utils_1.Document.colls({
104
+ persons: firebase_utils_1.Collection.docs({
105
+ [personId.guidString]: firebase_utils_1.Document.personWithSubscriptions(personId, ['fine-state-change'], tokens)
106
+ })
107
+ })
108
+ })
109
+ }, {
110
+ sendEachForMulticast: async (message) => {
111
+ messagingCalled = true;
112
+ return {
113
+ responses: message.tokens.map(token => ({
114
+ success: true,
115
+ messageId: `msg-${token}`
116
+ })),
117
+ successCount: message.tokens.length,
118
+ failureCount: 0
119
+ };
120
+ }
121
+ });
122
+ await (0, pushNotification_1.pushNotification)(teamId, personId, 'fine-state-change', {
123
+ title: 'Fine State Changed',
124
+ body: 'A fine state has been updated'
125
+ });
126
+ (0, core_1.expect)(messagingCalled).toBeTrue();
127
+ });
128
+ });
129
+ (0, mocha_1.describe)('token filtering', () => {
130
+ (0, mocha_1.it)('should handle person with empty token list', async () => {
131
+ const tokens = new typescript_common_functionality_1.Dictionary(index_1.NotificationProperties.TokenId.builder);
132
+ let messagingCalled = false;
133
+ (0, firebase_utils_1.configureFirebase)({
134
+ teams: firebase_utils_1.Collection.docs({
135
+ [teamId.guidString]: firebase_utils_1.Document.colls({
136
+ persons: firebase_utils_1.Collection.docs({
137
+ [personId.guidString]: firebase_utils_1.Document.personWithSubscriptions(personId, ['new-fine'], tokens)
138
+ })
139
+ })
140
+ })
141
+ }, {
142
+ sendEachForMulticast: async (message) => {
143
+ messagingCalled = true;
144
+ return {
145
+ responses: message.tokens.map(token => ({
146
+ success: true,
147
+ messageId: `msg-${token}`
148
+ })),
149
+ successCount: message.tokens.length,
150
+ failureCount: 0
151
+ };
152
+ }
153
+ });
154
+ await (0, pushNotification_1.pushNotification)(teamId, personId, 'new-fine', {
155
+ title: 'Test Notification',
156
+ body: 'Test Body'
157
+ });
158
+ (0, core_1.expect)(messagingCalled).toBeTrue();
159
+ });
160
+ (0, mocha_1.it)('should handle person with multiple tokens, removing invalid ones', async () => {
161
+ const tokens = new typescript_common_functionality_1.Dictionary(index_1.NotificationProperties.TokenId.builder);
162
+ for (let i = 1; i <= 5; i++)
163
+ tokens.set(index_1.NotificationProperties.TokenId.create(`device-token-${i}`), `device-token-${i}`);
164
+ let messagingCalled = false;
165
+ (0, firebase_utils_1.configureFirebase)({
166
+ teams: firebase_utils_1.Collection.docs({
167
+ [teamId.guidString]: firebase_utils_1.Document.colls({
168
+ persons: firebase_utils_1.Collection.docs({
169
+ [personId.guidString]: firebase_utils_1.Document.personWithSubscriptions(personId, ['new-fine'], tokens)
170
+ })
171
+ })
172
+ })
173
+ }, {
174
+ sendEachForMulticast: async (message) => {
175
+ messagingCalled = true;
176
+ return {
177
+ responses: message.tokens.map((token, index) => ({
178
+ success: index % 2 === 0,
179
+ messageId: index % 2 === 0 ? `msg-${token}` : undefined,
180
+ error: index % 2 === 0 ? undefined : {
181
+ code: index % 4 === 1 ? 'messaging/invalid-registration-token' : 'messaging/invalid-registration-token',
182
+ message: 'The provided token is invalid.',
183
+ toJSON: () => ({})
184
+ }
185
+ })),
186
+ successCount: Math.ceil(message.tokens.length / 2),
187
+ failureCount: Math.floor(message.tokens.length / 2)
188
+ };
189
+ }
190
+ });
191
+ await (0, pushNotification_1.pushNotification)(teamId, personId, 'new-fine', {
192
+ title: 'Test Notification',
193
+ body: 'Test Body'
194
+ });
195
+ (0, core_1.expect)(messagingCalled).toBeTrue();
196
+ const personSnapshot = await src_1.Firestore.shared.person(teamId, personId).snapshot();
197
+ (0, core_1.expect)(personSnapshot.exists).toBeTrue();
198
+ const person = index_1.Person.builder.build(personSnapshot.data);
199
+ (0, core_1.expect)(person.signInProperties).not.toBeNull();
200
+ const newTokens = person.signInProperties.notificationProperties.tokens.values;
201
+ (0, core_1.expect)(newTokens.length).toBeEqual(3);
202
+ (0, core_1.expect)(newTokens).toContainAll('device-token-1', 'device-token-3', 'device-token-5');
203
+ });
204
+ });
205
+ (0, mocha_1.describe)('subscription matching', () => {
206
+ (0, mocha_1.it)('should send when person is subscribed to multiple topics including the target', async () => {
207
+ const tokens = new typescript_common_functionality_1.Dictionary(index_1.NotificationProperties.TokenId.builder);
208
+ tokens.set(index_1.NotificationProperties.TokenId.create('device-token'), 'device-token');
209
+ let messagingCalled = false;
210
+ (0, firebase_utils_1.configureFirebase)({
211
+ teams: firebase_utils_1.Collection.docs({
212
+ [teamId.guidString]: firebase_utils_1.Document.colls({
213
+ persons: firebase_utils_1.Collection.docs({
214
+ [personId.guidString]: firebase_utils_1.Document.personWithSubscriptions(personId, ['new-fine', 'fine-reminder', 'fine-state-change'], tokens)
215
+ })
216
+ })
217
+ })
218
+ }, {
219
+ sendEachForMulticast: async (message) => {
220
+ messagingCalled = true;
221
+ return {
222
+ responses: message.tokens.map(token => ({
223
+ success: true,
224
+ messageId: `msg-${token}`
225
+ })),
226
+ successCount: message.tokens.length,
227
+ failureCount: 0
228
+ };
229
+ }
230
+ });
231
+ await (0, pushNotification_1.pushNotification)(teamId, personId, 'fine-reminder', {
232
+ title: 'Fine Reminder',
233
+ body: 'This is a reminder about your fine'
234
+ });
235
+ (0, core_1.expect)(messagingCalled).toBeTrue();
236
+ });
237
+ (0, mocha_1.it)('should not send when topic is not in subscription list', async () => {
238
+ const tokens = new typescript_common_functionality_1.Dictionary(index_1.NotificationProperties.TokenId.builder);
239
+ tokens.set(index_1.NotificationProperties.TokenId.create('device-token'), 'device-token');
240
+ let messagingCalled = false;
241
+ (0, firebase_utils_1.configureFirebase)({
242
+ teams: firebase_utils_1.Collection.docs({
243
+ [teamId.guidString]: firebase_utils_1.Document.colls({
244
+ persons: firebase_utils_1.Collection.docs({
245
+ [personId.guidString]: firebase_utils_1.Document.personWithSubscriptions(personId, ['fine-reminder'], tokens)
246
+ })
247
+ })
248
+ })
249
+ }, {
250
+ sendEachForMulticast: async (message) => {
251
+ messagingCalled = true;
252
+ return {
253
+ responses: message.tokens.map(token => ({
254
+ success: true,
255
+ messageId: `msg-${token}`
256
+ })),
257
+ successCount: message.tokens.length,
258
+ failureCount: 0
259
+ };
260
+ }
261
+ });
262
+ await (0, pushNotification_1.pushNotification)(teamId, personId, 'fine-state-change', {
263
+ title: 'Fine State Changed',
264
+ body: 'A fine state has been updated'
265
+ });
266
+ (0, core_1.expect)(messagingCalled).toBeFalse();
267
+ });
268
+ (0, mocha_1.it)('should handle person with no subscriptions', async () => {
269
+ const tokens = new typescript_common_functionality_1.Dictionary(index_1.NotificationProperties.TokenId.builder);
270
+ tokens.set(index_1.NotificationProperties.TokenId.create('device-token'), 'device-token');
271
+ let messagingCalled = false;
272
+ (0, firebase_utils_1.configureFirebase)({
273
+ teams: firebase_utils_1.Collection.docs({
274
+ [teamId.guidString]: firebase_utils_1.Document.colls({
275
+ persons: firebase_utils_1.Collection.docs({
276
+ [personId.guidString]: firebase_utils_1.Document.personWithSubscriptions(personId, [], tokens)
277
+ })
278
+ })
279
+ })
280
+ }, {
281
+ sendEachForMulticast: async (message) => {
282
+ messagingCalled = true;
283
+ return {
284
+ responses: message.tokens.map(token => ({
285
+ success: true,
286
+ messageId: `msg-${token}`
287
+ })),
288
+ successCount: message.tokens.length,
289
+ failureCount: 0
290
+ };
291
+ }
292
+ });
293
+ await (0, pushNotification_1.pushNotification)(teamId, personId, 'new-fine', {
294
+ title: 'Test Notification',
295
+ body: 'Test Body'
296
+ });
297
+ (0, core_1.expect)(messagingCalled).toBeFalse();
298
+ });
299
+ });
300
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@assertive-ts/core");
4
+ const types_1 = require("../../src/types");
5
+ describe('Localization for de', () => {
6
+ const locale = 'de';
7
+ const localization = types_1.Localization.shared(locale);
8
+ describe('notification.fine should be tested', () => {
9
+ it('notification.fine.new should be tested', () => {
10
+ (0, core_1.expect)(localization.notification.fine.new.title.value({ reason: 'fine-reason' })).toBeEqual('fine-reason');
11
+ (0, core_1.expect)(localization.notification.fine.new.body.value({ amount: '10,50 €' })).toBeEqual('Du hast eine neue Strafe von 10,50 €. Bitte so schnell wie möglich zahlen.');
12
+ });
13
+ it('notification.fine.reminder should be tested', () => {
14
+ (0, core_1.expect)(localization.notification.fine.reminder.title.value()).toBeEqual('Du hast noch offene Strafen');
15
+ (0, core_1.expect)(localization.notification.fine.reminder.body.value({ amount: '10,50 €' })).toBeEqual('Bei dir sind noch 10,50 € offen. Bitte so schnell wie möglich zahlen.');
16
+ });
17
+ it('notification.fine.stateChange should be tested', () => {
18
+ (0, core_1.expect)(localization.notification.fine.stateChange.title.value()).toBeEqual('Eine deiner Strafen hat sich geändert');
19
+ (0, core_1.expect)(localization.notification.fine.stateChange.bodyPayed.value({ amount: '10,50 €', reason: 'fine-reason' })).toBeEqual('Du hast eine Strafe von 10,50 € bezahlt (fine-reason).');
20
+ (0, core_1.expect)(localization.notification.fine.stateChange.bodyUnpayed.value({ amount: '10,50 €', reason: 'fine-reason' })).toBeEqual('fine-reason, 10,50 € ist noch offen.');
21
+ (0, core_1.expect)(localization.notification.fine.stateChange.bodyDeleted.value({ amount: '10,50 €', reason: 'fine-reason' })).toBeEqual('fine-reason, 10,50 € wurde gelöscht.');
22
+ });
23
+ });
24
+ describe('fineAmount should be tested', () => {
25
+ it('fineAmount.item.type.crateOfBeer should be tested', () => {
26
+ (0, core_1.expect)(localization.fineAmount.item.type.crateOfBeer.name.value()).toBeEqual('Kasten Bier');
27
+ (0, core_1.expect)(localization.fineAmount.item.type.crateOfBeer.withCount.value(1)).toBeEqual('Ein Kasten Bier');
28
+ (0, core_1.expect)(localization.fineAmount.item.type.crateOfBeer.withCount.value(4)).toBeEqual('4 Kästen Bier');
29
+ (0, core_1.expect)(localization.fineAmount.item.type.crateOfBeer.withoutCount.value(1)).toBeEqual('Kasten Bier');
30
+ (0, core_1.expect)(localization.fineAmount.item.type.crateOfBeer.withoutCount.value(4)).toBeEqual('Kästen Bier');
31
+ });
32
+ it('fineAmount.item.type.crateOfBeer should be formatted correctly', () => {
33
+ (0, core_1.expect)(types_1.FineAmount.Item.Type.formatted('crateOfBeer', locale)).toBeEqual('Kasten Bier');
34
+ (0, core_1.expect)(new types_1.FineAmount.Item('crateOfBeer', 1).formatted(locale)).toBeEqual('Ein Kasten Bier');
35
+ (0, core_1.expect)(new types_1.FineAmount.Item('crateOfBeer', 4).formatted(locale)).toBeEqual('4 Kästen Bier');
36
+ (0, core_1.expect)(new types_1.FineAmount.Item('crateOfBeer', 1).formattedWithoutCount(locale)).toBeEqual('Kasten Bier');
37
+ (0, core_1.expect)(new types_1.FineAmount.Item('crateOfBeer', 4).formattedWithoutCount(locale)).toBeEqual('Kästen Bier');
38
+ });
39
+ });
40
+ describe('fineTemplateRepetition should be tested', () => {
41
+ it('fineTemplateRepetition.item.minute should be tested', () => {
42
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.minute.name.value()).toBeEqual('Minute');
43
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.minute.withCount.value(1)).toBeEqual('1 Minute');
44
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.minute.withCount.value(4)).toBeEqual('4 Minuten');
45
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.minute.withoutCount.value(1)).toBeEqual('Minute');
46
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.minute.withoutCount.value(4)).toBeEqual('Minuten');
47
+ });
48
+ it('fineTemplateRepetition.item.minute should be formatted correctly', () => {
49
+ (0, core_1.expect)(types_1.FineTemplateRepetition.Item.formatted('minute', locale)).toBeEqual('Minute');
50
+ (0, core_1.expect)(new types_1.FineTemplateRepetition('minute', null).formatted(1, locale)).toBeEqual('1 Minute');
51
+ (0, core_1.expect)(new types_1.FineTemplateRepetition('minute', null).formatted(4, locale)).toBeEqual('4 Minuten');
52
+ (0, core_1.expect)(new types_1.FineTemplateRepetition('minute', null).formattedWithoutCount(1, locale)).toBeEqual('Minute');
53
+ (0, core_1.expect)(new types_1.FineTemplateRepetition('minute', null).formattedWithoutCount(4, locale)).toBeEqual('Minuten');
54
+ });
55
+ it('fineTemplateRepetition.item.day should be tested', () => {
56
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.day.name.value()).toBeEqual('Tag');
57
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.day.withCount.value(1)).toBeEqual('1 Tag');
58
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.day.withCount.value(4)).toBeEqual('4 Tage');
59
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.day.withoutCount.value(1)).toBeEqual('Tag');
60
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.day.withoutCount.value(4)).toBeEqual('Tage');
61
+ });
62
+ it('fineTemplateRepetition.item.day should be formatted correctly', () => {
63
+ (0, core_1.expect)(types_1.FineTemplateRepetition.Item.formatted('day', locale)).toBeEqual('Tag');
64
+ (0, core_1.expect)(new types_1.FineTemplateRepetition('day', null).formatted(1, locale)).toBeEqual('1 Tag');
65
+ (0, core_1.expect)(new types_1.FineTemplateRepetition('day', null).formatted(4, locale)).toBeEqual('4 Tage');
66
+ (0, core_1.expect)(new types_1.FineTemplateRepetition('day', null).formattedWithoutCount(1, locale)).toBeEqual('Tag');
67
+ (0, core_1.expect)(new types_1.FineTemplateRepetition('day', null).formattedWithoutCount(4, locale)).toBeEqual('Tage');
68
+ });
69
+ it('fineTemplateRepetition.item.item should be tested', () => {
70
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.item.name.value()).toBeEqual('Teil');
71
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.item.withCount.value(1)).toBeEqual('1 Teil');
72
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.item.withCount.value(4)).toBeEqual('4 Teile');
73
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.item.withoutCount.value(1)).toBeEqual('Teil');
74
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.item.withoutCount.value(4)).toBeEqual('Teile');
75
+ });
76
+ it('fineTemplateRepetition.item.item should be formatted correctly', () => {
77
+ (0, core_1.expect)(types_1.FineTemplateRepetition.Item.formatted('item', locale)).toBeEqual('Teil');
78
+ (0, core_1.expect)(new types_1.FineTemplateRepetition('item', null).formatted(1, locale)).toBeEqual('1 Teil');
79
+ (0, core_1.expect)(new types_1.FineTemplateRepetition('item', null).formatted(4, locale)).toBeEqual('4 Teile');
80
+ (0, core_1.expect)(new types_1.FineTemplateRepetition('item', null).formattedWithoutCount(1, locale)).toBeEqual('Teil');
81
+ (0, core_1.expect)(new types_1.FineTemplateRepetition('item', null).formattedWithoutCount(4, locale)).toBeEqual('Teile');
82
+ });
83
+ it('fineTemplateRepetition.item.count should be tested', () => {
84
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.count.name.value()).toBeEqual('Anzahl');
85
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.count.withCount.value(1)).toBeEqual('1 mal');
86
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.count.withCount.value(4)).toBeEqual('4 mal');
87
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.count.withoutCount.value(1)).toBeEqual('mal');
88
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.count.withoutCount.value(4)).toBeEqual('mal');
89
+ });
90
+ it('fineTemplateRepetition.item.count should be formatted correctly', () => {
91
+ (0, core_1.expect)(types_1.FineTemplateRepetition.Item.formatted('count', locale)).toBeEqual('Anzahl');
92
+ (0, core_1.expect)(new types_1.FineTemplateRepetition('count', null).formatted(1, locale)).toBeEqual('1 mal');
93
+ (0, core_1.expect)(new types_1.FineTemplateRepetition('count', null).formatted(4, locale)).toBeEqual('4 mal');
94
+ (0, core_1.expect)(new types_1.FineTemplateRepetition('count', null).formattedWithoutCount(1, locale)).toBeEqual('mal');
95
+ (0, core_1.expect)(new types_1.FineTemplateRepetition('count', null).formattedWithoutCount(4, locale)).toBeEqual('mal');
96
+ });
97
+ });
98
+ describe('payedState should be tested', () => {
99
+ it('payedState.payed should be tested', () => {
100
+ (0, core_1.expect)(localization.payedState.payed.value()).toBeEqual('Bezahlt');
101
+ });
102
+ it('payedState.payed should be formatted correctly', () => {
103
+ (0, core_1.expect)(types_1.PayedState.formatted('payed', locale)).toBeEqual('Bezahlt');
104
+ });
105
+ it('payedState.notPayed should be tested', () => {
106
+ (0, core_1.expect)(localization.payedState.notPayed.value()).toBeEqual('Offen');
107
+ });
108
+ it('payedState.notPayed should be formatted correctly', () => {
109
+ (0, core_1.expect)(types_1.PayedState.formatted('notPayed', locale)).toBeEqual('Offen');
110
+ });
111
+ });
112
+ describe('userRole should be tested', () => {
113
+ it('userRole.personManager should be tested', () => {
114
+ (0, core_1.expect)(localization.userRole.personManager.value()).toBeEqual('Personenmanager');
115
+ });
116
+ it('userRole.personManager should be formatted correctly', () => {
117
+ (0, core_1.expect)(types_1.UserRole.formatted('person-manager', locale)).toBeEqual('Personenmanager');
118
+ });
119
+ it('userRole.fineTemplateManager should be tested', () => {
120
+ (0, core_1.expect)(localization.userRole.fineTemplateManager.value()).toBeEqual('Strafvorlagenmanager');
121
+ });
122
+ it('userRole.fineTemplateManager should be formatted correctly', () => {
123
+ (0, core_1.expect)(types_1.UserRole.formatted('fineTemplate-manager', locale)).toBeEqual('Strafvorlagenmanager');
124
+ });
125
+ it('userRole.fineManager should be tested', () => {
126
+ (0, core_1.expect)(localization.userRole.fineManager.value()).toBeEqual('Strafenmanager');
127
+ });
128
+ it('userRole.fineManager should be formatted correctly', () => {
129
+ (0, core_1.expect)(types_1.UserRole.formatted('fine-manager', locale)).toBeEqual('Strafenmanager');
130
+ });
131
+ it('userRole.fineCanAdd should be tested', () => {
132
+ (0, core_1.expect)(localization.userRole.fineCanAdd.value()).toBeEqual('Kann Strafen hinzufügen');
133
+ });
134
+ it('userRole.fineCanAdd should be formatted correctly', () => {
135
+ (0, core_1.expect)(types_1.UserRole.formatted('fine-can-add', locale)).toBeEqual('Kann Strafen hinzufügen');
136
+ });
137
+ it('userRole.teamManager should be tested', () => {
138
+ (0, core_1.expect)(localization.userRole.teamManager.value()).toBeEqual('Teammanager');
139
+ });
140
+ it('userRole.teamManager should be formatted correctly', () => {
141
+ (0, core_1.expect)(types_1.UserRole.formatted('team-manager', locale)).toBeEqual('Teammanager');
142
+ });
143
+ });
144
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@assertive-ts/core");
4
+ const types_1 = require("../../src/types");
5
+ describe('Localization for en', () => {
6
+ const locale = 'en';
7
+ const localization = types_1.Localization.shared(locale);
8
+ describe('notification.fine should be tested', () => {
9
+ it('notification.fine.new should be tested', () => {
10
+ (0, core_1.expect)(localization.notification.fine.new.title.value({ reason: 'fine-reason' })).toBeEqual('fine-reason');
11
+ (0, core_1.expect)(localization.notification.fine.new.body.value({ amount: '10.50 €' })).toBeEqual('You have a new fine of 10.50 €. Please pay it as soon as possible.');
12
+ });
13
+ it('notification.fine.reminder should be tested', () => {
14
+ (0, core_1.expect)(localization.notification.fine.reminder.title.value()).toBeEqual('You still have outstanding fines');
15
+ (0, core_1.expect)(localization.notification.fine.reminder.body.value({ amount: '10.50 €' })).toBeEqual('You still have 10.50 € outstanding. Please pay as soon as possible.');
16
+ });
17
+ it('notification.fine.stateChange should be tested', () => {
18
+ (0, core_1.expect)(localization.notification.fine.stateChange.title.value()).toBeEqual('One of your fines has changed');
19
+ (0, core_1.expect)(localization.notification.fine.stateChange.bodyPayed.value({ amount: '10.50 €', reason: 'fine-reason' })).toBeEqual('You have paid a fine of 10.50 € (fine-reason).');
20
+ (0, core_1.expect)(localization.notification.fine.stateChange.bodyUnpayed.value({ amount: '10.50 €', reason: 'fine-reason' })).toBeEqual('fine-reason, 10.50 € is still outstanding.');
21
+ (0, core_1.expect)(localization.notification.fine.stateChange.bodyDeleted.value({ amount: '10.50 €', reason: 'fine-reason' })).toBeEqual('fine-reason, 10.50 € has been deleted.');
22
+ });
23
+ });
24
+ describe('fineAmount should be tested', () => {
25
+ it('fineAmount.item.type.crateOfBeer should be tested', () => {
26
+ (0, core_1.expect)(localization.fineAmount.item.type.crateOfBeer.name.value()).toBeEqual('Crate of Beer');
27
+ (0, core_1.expect)(localization.fineAmount.item.type.crateOfBeer.withCount.value(1)).toBeEqual('a crate of beer');
28
+ (0, core_1.expect)(localization.fineAmount.item.type.crateOfBeer.withCount.value(4)).toBeEqual('4 crates of beer');
29
+ (0, core_1.expect)(localization.fineAmount.item.type.crateOfBeer.withoutCount.value(1)).toBeEqual('Crate of Beer');
30
+ (0, core_1.expect)(localization.fineAmount.item.type.crateOfBeer.withoutCount.value(4)).toBeEqual('Crates of Beer');
31
+ });
32
+ it('fineAmount.item.type.crateOfBeer should be formatted correctly', () => {
33
+ (0, core_1.expect)(types_1.FineAmount.Item.Type.formatted('crateOfBeer', locale)).toBeEqual('Crate of Beer');
34
+ (0, core_1.expect)(new types_1.FineAmount.Item('crateOfBeer', 1).formatted(locale)).toBeEqual('a crate of beer');
35
+ (0, core_1.expect)(new types_1.FineAmount.Item('crateOfBeer', 4).formatted(locale)).toBeEqual('4 crates of beer');
36
+ (0, core_1.expect)(new types_1.FineAmount.Item('crateOfBeer', 1).formattedWithoutCount(locale)).toBeEqual('Crate of Beer');
37
+ (0, core_1.expect)(new types_1.FineAmount.Item('crateOfBeer', 4).formattedWithoutCount(locale)).toBeEqual('Crates of Beer');
38
+ });
39
+ });
40
+ describe('fineTemplateRepetition should be tested', () => {
41
+ it('fineTemplateRepetition.item.minute should be tested', () => {
42
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.minute.name.value()).toBeEqual('Minute');
43
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.minute.withCount.value(1)).toBeEqual('1 minute');
44
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.minute.withCount.value(4)).toBeEqual('4 minutes');
45
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.minute.withoutCount.value(1)).toBeEqual('minute');
46
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.minute.withoutCount.value(4)).toBeEqual('minutes');
47
+ });
48
+ it('fineTemplateRepetition.item.minute should be formatted correctly', () => {
49
+ (0, core_1.expect)(types_1.FineTemplateRepetition.Item.formatted('minute', locale)).toBeEqual('Minute');
50
+ (0, core_1.expect)(new types_1.FineTemplateRepetition('minute', null).formatted(1, locale)).toBeEqual('1 minute');
51
+ (0, core_1.expect)(new types_1.FineTemplateRepetition('minute', null).formatted(4, locale)).toBeEqual('4 minutes');
52
+ (0, core_1.expect)(new types_1.FineTemplateRepetition('minute', null).formattedWithoutCount(1, locale)).toBeEqual('minute');
53
+ (0, core_1.expect)(new types_1.FineTemplateRepetition('minute', null).formattedWithoutCount(4, locale)).toBeEqual('minutes');
54
+ });
55
+ it('fineTemplateRepetition.item.day should be tested', () => {
56
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.day.name.value()).toBeEqual('Day');
57
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.day.withCount.value(1)).toBeEqual('1 day');
58
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.day.withCount.value(4)).toBeEqual('4 days');
59
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.day.withoutCount.value(1)).toBeEqual('day');
60
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.day.withoutCount.value(4)).toBeEqual('days');
61
+ });
62
+ it('fineTemplateRepetition.item.day should be formatted correctly', () => {
63
+ (0, core_1.expect)(types_1.FineTemplateRepetition.Item.formatted('day', locale)).toBeEqual('Day');
64
+ (0, core_1.expect)(new types_1.FineTemplateRepetition('day', null).formatted(1, locale)).toBeEqual('1 day');
65
+ (0, core_1.expect)(new types_1.FineTemplateRepetition('day', null).formatted(4, locale)).toBeEqual('4 days');
66
+ (0, core_1.expect)(new types_1.FineTemplateRepetition('day', null).formattedWithoutCount(1, locale)).toBeEqual('day');
67
+ (0, core_1.expect)(new types_1.FineTemplateRepetition('day', null).formattedWithoutCount(4, locale)).toBeEqual('days');
68
+ });
69
+ it('fineTemplateRepetition.item.item should be tested', () => {
70
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.item.name.value()).toBeEqual('Item');
71
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.item.withCount.value(1)).toBeEqual('1 item');
72
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.item.withCount.value(4)).toBeEqual('4 items');
73
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.item.withoutCount.value(1)).toBeEqual('item');
74
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.item.withoutCount.value(4)).toBeEqual('items');
75
+ });
76
+ it('fineTemplateRepetition.item.item should be formatted correctly', () => {
77
+ (0, core_1.expect)(types_1.FineTemplateRepetition.Item.formatted('item', locale)).toBeEqual('Item');
78
+ (0, core_1.expect)(new types_1.FineTemplateRepetition('item', null).formatted(1, locale)).toBeEqual('1 item');
79
+ (0, core_1.expect)(new types_1.FineTemplateRepetition('item', null).formatted(4, locale)).toBeEqual('4 items');
80
+ (0, core_1.expect)(new types_1.FineTemplateRepetition('item', null).formattedWithoutCount(1, locale)).toBeEqual('item');
81
+ (0, core_1.expect)(new types_1.FineTemplateRepetition('item', null).formattedWithoutCount(4, locale)).toBeEqual('items');
82
+ });
83
+ it('fineTemplateRepetition.item.count should be tested', () => {
84
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.count.name.value()).toBeEqual('Count');
85
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.count.withCount.value(1)).toBeEqual('1 time');
86
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.count.withCount.value(4)).toBeEqual('4 times');
87
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.count.withoutCount.value(1)).toBeEqual('time');
88
+ (0, core_1.expect)(localization.fineTemplateRepetition.item.count.withoutCount.value(4)).toBeEqual('times');
89
+ });
90
+ it('fineTemplateRepetition.item.count should be formatted correctly', () => {
91
+ (0, core_1.expect)(types_1.FineTemplateRepetition.Item.formatted('count', locale)).toBeEqual('Count');
92
+ (0, core_1.expect)(new types_1.FineTemplateRepetition('count', null).formatted(1, locale)).toBeEqual('1 time');
93
+ (0, core_1.expect)(new types_1.FineTemplateRepetition('count', null).formatted(4, locale)).toBeEqual('4 times');
94
+ (0, core_1.expect)(new types_1.FineTemplateRepetition('count', null).formattedWithoutCount(1, locale)).toBeEqual('time');
95
+ (0, core_1.expect)(new types_1.FineTemplateRepetition('count', null).formattedWithoutCount(4, locale)).toBeEqual('times');
96
+ });
97
+ });
98
+ describe('payedState should be tested', () => {
99
+ it('payedState.payed should be tested', () => {
100
+ (0, core_1.expect)(localization.payedState.payed.value()).toBeEqual('Paid');
101
+ });
102
+ it('payedState.payed should be formatted correctly', () => {
103
+ (0, core_1.expect)(types_1.PayedState.formatted('payed', locale)).toBeEqual('Paid');
104
+ });
105
+ it('payedState.notPayed should be tested', () => {
106
+ (0, core_1.expect)(localization.payedState.notPayed.value()).toBeEqual('Outstanding');
107
+ });
108
+ it('payedState.notPayed should be formatted correctly', () => {
109
+ (0, core_1.expect)(types_1.PayedState.formatted('notPayed', locale)).toBeEqual('Outstanding');
110
+ });
111
+ });
112
+ describe('userRole should be tested', () => {
113
+ it('userRole.personManager should be tested', () => {
114
+ (0, core_1.expect)(localization.userRole.personManager.value()).toBeEqual('Person Manager');
115
+ });
116
+ it('userRole.personManager should be formatted correctly', () => {
117
+ (0, core_1.expect)(types_1.UserRole.formatted('person-manager', locale)).toBeEqual('Person Manager');
118
+ });
119
+ it('userRole.fineTemplateManager should be tested', () => {
120
+ (0, core_1.expect)(localization.userRole.fineTemplateManager.value()).toBeEqual('Fine Template Manager');
121
+ });
122
+ it('userRole.fineTemplateManager should be formatted correctly', () => {
123
+ (0, core_1.expect)(types_1.UserRole.formatted('fineTemplate-manager', locale)).toBeEqual('Fine Template Manager');
124
+ });
125
+ it('userRole.fineManager should be tested', () => {
126
+ (0, core_1.expect)(localization.userRole.fineManager.value()).toBeEqual('Fine Manager');
127
+ });
128
+ it('userRole.fineManager should be formatted correctly', () => {
129
+ (0, core_1.expect)(types_1.UserRole.formatted('fine-manager', locale)).toBeEqual('Fine Manager');
130
+ });
131
+ it('userRole.fineCanAdd should be tested', () => {
132
+ (0, core_1.expect)(localization.userRole.fineCanAdd.value()).toBeEqual('Can add fines');
133
+ });
134
+ it('userRole.fineCanAdd should be formatted correctly', () => {
135
+ (0, core_1.expect)(types_1.UserRole.formatted('fine-can-add', locale)).toBeEqual('Can add fines');
136
+ });
137
+ it('userRole.teamManager should be tested', () => {
138
+ (0, core_1.expect)(localization.userRole.teamManager.value()).toBeEqual('Team Manager');
139
+ });
140
+ it('userRole.teamManager should be formatted correctly', () => {
141
+ (0, core_1.expect)(types_1.UserRole.formatted('team-manager', locale)).toBeEqual('Team Manager');
142
+ });
143
+ });
144
+ });
@@ -0,0 +1 @@
1
+ export {};