@stevenkellner/team-conduct-api 2.0.18 → 2.0.20

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 (231) hide show
  1. package/lib/src/functions/fine/add.d.ts +3 -8
  2. package/lib/src/functions/fine/add.js +1 -2
  3. package/lib/src/functions/fine/delete.d.ts +1 -6
  4. package/lib/src/functions/fine/delete.js +2 -3
  5. package/lib/src/functions/fine/update.d.ts +2 -8
  6. package/lib/src/functions/fine/update.js +1 -3
  7. package/lib/src/functions/fineTemplate/add.d.ts +3 -3
  8. package/lib/src/functions/fineTemplate/update.d.ts +3 -3
  9. package/lib/src/functions/firebaseFunctionsContext.d.ts +34 -1
  10. package/lib/src/functions/firebaseFunctionsContext.js +33 -33
  11. package/lib/src/functions/index.d.ts +10 -8
  12. package/lib/src/functions/index.js +11 -8
  13. package/lib/src/functions/notification/markNotificationAsRead.d.ts +14 -0
  14. package/lib/src/functions/notification/{subscribe.js → markNotificationAsRead.js} +5 -7
  15. package/lib/src/functions/person/kickout.d.ts +6 -6
  16. package/lib/src/functions/person/kickout.js +4 -4
  17. package/lib/src/functions/person/roleEdit.d.ts +5 -5
  18. package/lib/src/functions/person/roleEdit.js +3 -3
  19. package/lib/src/functions/{paypalMe/edit.d.ts → team/delete.d.ts} +5 -7
  20. package/lib/src/functions/{paypalMe/edit.js → team/delete.js} +4 -5
  21. package/lib/src/functions/team/new.d.ts +18 -18
  22. package/lib/src/functions/team/new.js +8 -4
  23. package/lib/src/functions/team/update.d.ts +34 -0
  24. package/lib/src/functions/team/update.js +23 -0
  25. package/lib/src/functions/user/register.d.ts +4 -0
  26. package/lib/src/functions/user/register.js +3 -1
  27. package/lib/src/functions/user/update.d.ts +26 -0
  28. package/lib/src/functions/user/update.js +15 -0
  29. package/lib/src/index.d.ts +1 -1
  30. package/lib/src/index.js +1 -1
  31. package/lib/src/locales/de.d.ts +1 -1
  32. package/lib/src/locales/de.js +6 -2
  33. package/lib/src/locales/en.d.ts +6 -2
  34. package/lib/src/locales/en.js +6 -2
  35. package/lib/src/types/{MoneyAmount.d.ts → Money.d.ts} +23 -23
  36. package/lib/src/types/{MoneyAmount.js → Money.js} +25 -25
  37. package/lib/src/types/fine/Fine.d.ts +275 -0
  38. package/lib/src/types/fine/Fine.js +318 -0
  39. package/lib/src/types/fine/FineTemplate.d.ts +154 -0
  40. package/lib/src/types/fine/FineTemplate.js +170 -0
  41. package/lib/src/types/{PayedState.d.ts → fine/PayedState.d.ts} +1 -1
  42. package/lib/src/types/{PayedState.js → fine/PayedState.js} +1 -1
  43. package/lib/src/types/fine/index.d.ts +3 -0
  44. package/lib/src/{firebase → types/fine}/index.js +3 -6
  45. package/lib/src/types/index.d.ts +7 -18
  46. package/lib/src/types/index.js +7 -18
  47. package/lib/src/types/{Localization.d.ts → localization/Localization.d.ts} +15 -43
  48. package/lib/src/types/localization/Localization.js +54 -0
  49. package/lib/src/types/localization/PluralLocalization.d.ts +23 -0
  50. package/lib/src/types/localization/PluralLocalization.js +35 -0
  51. package/lib/src/types/{Pluralization.d.ts → localization/Pluralization.d.ts} +1 -0
  52. package/lib/src/types/{Pluralization.js → localization/Pluralization.js} +1 -0
  53. package/lib/src/types/localization/ValueLocalization.d.ts +22 -0
  54. package/lib/src/types/localization/ValueLocalization.js +41 -0
  55. package/lib/src/types/localization/index.d.ts +5 -0
  56. package/lib/src/types/localization/index.js +21 -0
  57. package/lib/src/types/notification/InAppNotification.d.ts +152 -0
  58. package/lib/src/types/notification/InAppNotification.js +136 -0
  59. package/lib/src/types/notification/index.d.ts +1 -0
  60. package/lib/src/types/notification/index.js +17 -0
  61. package/lib/src/types/{Person.d.ts → person/Person.d.ts} +3 -3
  62. package/lib/src/types/{Person.js → person/Person.js} +3 -3
  63. package/lib/src/types/{PersonProperties.d.ts → person/PersonProperties.d.ts} +8 -7
  64. package/lib/src/types/{PersonProperties.js → person/PersonProperties.js} +7 -6
  65. package/lib/src/types/{PersonSignInProperties.d.ts → person/PersonSignInProperties.d.ts} +9 -11
  66. package/lib/src/types/{PersonSignInProperties.js → person/PersonSignInProperties.js} +7 -10
  67. package/lib/src/types/person/index.d.ts +3 -0
  68. package/lib/src/types/person/index.js +19 -0
  69. package/lib/src/types/{Invitation.d.ts → team/Invitation.d.ts} +1 -1
  70. package/lib/src/types/{Invitation.js → team/Invitation.js} +1 -1
  71. package/lib/src/types/team/Team.d.ts +144 -0
  72. package/lib/src/types/team/Team.js +141 -0
  73. package/lib/src/types/team/TeamRole.d.ts +30 -0
  74. package/lib/src/types/{UserRole.js → team/TeamRole.js} +16 -15
  75. package/lib/src/types/team/index.d.ts +3 -0
  76. package/lib/src/types/team/index.js +19 -0
  77. package/lib/src/types/{NotificationProperties.d.ts → user/NotificationProperties.d.ts} +8 -3
  78. package/lib/src/types/{NotificationProperties.js → user/NotificationProperties.js} +4 -0
  79. package/lib/src/types/user/User.d.ts +328 -0
  80. package/lib/src/types/user/User.js +355 -0
  81. package/lib/src/types/user/index.d.ts +2 -0
  82. package/lib/src/types/user/index.js +18 -0
  83. package/lib/src/utils/StaticUnionTypeBuilder.d.ts +9 -0
  84. package/lib/src/utils/StaticUnionTypeBuilder.js +23 -0
  85. package/lib/src/utils/index.d.ts +1 -0
  86. package/lib/src/utils/index.js +17 -0
  87. package/lib/tsconfig.tsbuildinfo +1 -1
  88. package/package.json +4 -3
  89. package/src/functions/fine/add.ts +3 -5
  90. package/src/functions/fine/delete.ts +3 -5
  91. package/src/functions/fine/update.ts +2 -5
  92. package/src/functions/firebaseFunctionsContext.ts +40 -40
  93. package/src/functions/index.ts +11 -9
  94. package/src/functions/notification/markNotificationAsRead.ts +19 -0
  95. package/src/functions/person/add.ts +1 -1
  96. package/src/functions/person/kickout.ts +6 -6
  97. package/src/functions/person/roleEdit.ts +5 -5
  98. package/src/functions/{paypalMe/edit.ts → team/delete.ts} +5 -7
  99. package/src/functions/team/new.ts +19 -11
  100. package/src/functions/team/update.ts +40 -0
  101. package/src/functions/user/register.ts +7 -3
  102. package/src/functions/user/update.ts +29 -0
  103. package/src/index.ts +1 -1
  104. package/src/locales/de.ts +7 -3
  105. package/src/locales/en.ts +7 -3
  106. package/src/types/{MoneyAmount.ts → Money.ts} +29 -29
  107. package/src/types/fine/Fine.ts +399 -0
  108. package/src/types/fine/FineTemplate.ts +219 -0
  109. package/src/types/{PayedState.ts → fine/PayedState.ts} +2 -2
  110. package/src/types/fine/index.ts +3 -0
  111. package/src/types/index.ts +7 -18
  112. package/src/types/{Localization.ts → localization/Localization.ts} +7 -64
  113. package/src/types/localization/PluralLocalization.ts +32 -0
  114. package/src/types/{Pluralization.ts → localization/Pluralization.ts} +1 -0
  115. package/src/types/localization/ValueLocalization.ts +36 -0
  116. package/src/types/localization/index.ts +5 -0
  117. package/src/types/notification/InAppNotification.ts +184 -0
  118. package/src/types/notification/index.ts +1 -0
  119. package/src/types/{Person.ts → person/Person.ts} +3 -3
  120. package/src/types/{PersonProperties.ts → person/PersonProperties.ts} +8 -7
  121. package/src/types/{PersonSignInProperties.ts → person/PersonSignInProperties.ts} +13 -12
  122. package/src/types/person/index.ts +3 -0
  123. package/src/types/{Invitation.ts → team/Invitation.ts} +1 -1
  124. package/src/types/team/Team.ts +204 -0
  125. package/src/types/{UserRole.ts → team/TeamRole.ts} +19 -17
  126. package/src/types/team/index.ts +3 -0
  127. package/src/types/{NotificationProperties.ts → user/NotificationProperties.ts} +12 -3
  128. package/src/types/user/User.ts +451 -0
  129. package/src/types/user/index.ts +2 -0
  130. package/src/utils/StaticUnionTypeBuilder.ts +23 -0
  131. package/src/utils/index.ts +1 -0
  132. package/lib/src/firebase/FirebaseConfiguration.d.ts +0 -64
  133. package/lib/src/firebase/FirebaseConfiguration.js +0 -79
  134. package/lib/src/firebase/Firestore.d.ts +0 -201
  135. package/lib/src/firebase/Firestore.js +0 -244
  136. package/lib/src/firebase/FirestoreScheme.d.ts +0 -42
  137. package/lib/src/firebase/FirestoreScheme.js +0 -2
  138. package/lib/src/firebase/Messaging.d.ts +0 -90
  139. package/lib/src/firebase/Messaging.js +0 -2
  140. package/lib/src/firebase/checkAuthentication.d.ts +0 -38
  141. package/lib/src/firebase/checkAuthentication.js +0 -64
  142. package/lib/src/firebase/index.d.ts +0 -6
  143. package/lib/src/firebase/pushNotification.d.ts +0 -39
  144. package/lib/src/firebase/pushNotification.js +0 -88
  145. package/lib/src/functions/notification/subscribe.d.ts +0 -18
  146. package/lib/src/types/Configuration.d.ts +0 -46
  147. package/lib/src/types/Configuration.js +0 -51
  148. package/lib/src/types/Fine.d.ts +0 -71
  149. package/lib/src/types/Fine.js +0 -74
  150. package/lib/src/types/FineAmount.d.ts +0 -207
  151. package/lib/src/types/FineAmount.js +0 -238
  152. package/lib/src/types/FineTemplate.d.ts +0 -69
  153. package/lib/src/types/FineTemplate.js +0 -72
  154. package/lib/src/types/FineTemplateRepetition.d.ts +0 -87
  155. package/lib/src/types/FineTemplateRepetition.js +0 -103
  156. package/lib/src/types/Localization.js +0 -115
  157. package/lib/src/types/Team.d.ts +0 -62
  158. package/lib/src/types/Team.js +0 -64
  159. package/lib/src/types/User.d.ts +0 -221
  160. package/lib/src/types/User.js +0 -235
  161. package/lib/src/types/UserRole.d.ts +0 -29
  162. package/lib/test/firebase/FirebaseConfiguration.test.d.ts +0 -1
  163. package/lib/test/firebase/FirebaseConfiguration.test.js +0 -158
  164. package/lib/test/firebase/Firestore.test.d.ts +0 -1
  165. package/lib/test/firebase/Firestore.test.js +0 -46
  166. package/lib/test/firebase/checkAuthentication.test.d.ts +0 -1
  167. package/lib/test/firebase/checkAuthentication.test.js +0 -356
  168. package/lib/test/firebase/firebase-utils.d.ts +0 -32
  169. package/lib/test/firebase/firebase-utils.js +0 -134
  170. package/lib/test/firebase/pushNotification.test.d.ts +0 -1
  171. package/lib/test/firebase/pushNotification.test.js +0 -300
  172. package/lib/test/locales/localization.de.test.d.ts +0 -1
  173. package/lib/test/locales/localization.de.test.js +0 -144
  174. package/lib/test/locales/localization.en.test.d.ts +0 -1
  175. package/lib/test/locales/localization.en.test.js +0 -144
  176. package/lib/test/types/Configuration.test.d.ts +0 -1
  177. package/lib/test/types/Configuration.test.js +0 -84
  178. package/lib/test/types/Currency.test.d.ts +0 -1
  179. package/lib/test/types/Currency.test.js +0 -41
  180. package/lib/test/types/Fine.test.d.ts +0 -1
  181. package/lib/test/types/Fine.test.js +0 -265
  182. package/lib/test/types/FineAmount.test.d.ts +0 -1
  183. package/lib/test/types/FineAmount.test.js +0 -445
  184. package/lib/test/types/FineTemplate.test.d.ts +0 -1
  185. package/lib/test/types/FineTemplate.test.js +0 -271
  186. package/lib/test/types/FineTemplateRepetition.test.d.ts +0 -1
  187. package/lib/test/types/FineTemplateRepetition.test.js +0 -361
  188. package/lib/test/types/Invitation.test.d.ts +0 -1
  189. package/lib/test/types/Invitation.test.js +0 -269
  190. package/lib/test/types/Locale.test.d.ts +0 -1
  191. package/lib/test/types/Locale.test.js +0 -46
  192. package/lib/test/types/Localization.test.d.ts +0 -1
  193. package/lib/test/types/Localization.test.js +0 -241
  194. package/lib/test/types/MoneyAmount.test.d.ts +0 -1
  195. package/lib/test/types/MoneyAmount.test.js +0 -276
  196. package/lib/test/types/NotificationProperties.test.d.ts +0 -1
  197. package/lib/test/types/NotificationProperties.test.js +0 -258
  198. package/lib/test/types/PayedState.test.d.ts +0 -1
  199. package/lib/test/types/PayedState.test.js +0 -136
  200. package/lib/test/types/Person.test.d.ts +0 -1
  201. package/lib/test/types/Person.test.js +0 -266
  202. package/lib/test/types/PersonProperties.test.d.ts +0 -1
  203. package/lib/test/types/PersonProperties.test.js +0 -155
  204. package/lib/test/types/PersonSignInProperties.test.d.ts +0 -1
  205. package/lib/test/types/PersonSignInProperties.test.js +0 -208
  206. package/lib/test/types/Pluralization.test.d.ts +0 -1
  207. package/lib/test/types/Pluralization.test.js +0 -206
  208. package/lib/test/types/Team.test.d.ts +0 -1
  209. package/lib/test/types/Team.test.js +0 -145
  210. package/lib/test/types/User.test.d.ts +0 -1
  211. package/lib/test/types/User.test.js +0 -450
  212. package/lib/test/types/UserRole.test.d.ts +0 -1
  213. package/lib/test/types/UserRole.test.js +0 -140
  214. package/src/firebase/FirebaseConfiguration.ts +0 -99
  215. package/src/firebase/Firestore.ts +0 -258
  216. package/src/firebase/FirestoreScheme.ts +0 -41
  217. package/src/firebase/Messaging.ts +0 -93
  218. package/src/firebase/checkAuthentication.ts +0 -91
  219. package/src/firebase/index.ts +0 -7
  220. package/src/firebase/pushNotification.ts +0 -90
  221. package/src/functions/notification/subscribe.ts +0 -23
  222. package/src/types/Configuration.ts +0 -65
  223. package/src/types/Fine.ts +0 -100
  224. package/src/types/FineAmount.ts +0 -303
  225. package/src/types/FineTemplate.ts +0 -96
  226. package/src/types/FineTemplateRepetition.ts +0 -125
  227. package/src/types/Team.ts +0 -87
  228. package/src/types/User.ts +0 -302
  229. /package/lib/src/types/{Locale.d.ts → localization/Locale.d.ts} +0 -0
  230. /package/lib/src/types/{Locale.js → localization/Locale.js} +0 -0
  231. /package/src/types/{Locale.ts → localization/Locale.ts} +0 -0
@@ -1,208 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const core_1 = require("@assertive-ts/core");
4
- const PersonSignInProperties_1 = require("../../src/types/PersonSignInProperties");
5
- const User_1 = require("../../src/types/User");
6
- const NotificationProperties_1 = require("../../src/types/NotificationProperties");
7
- const typescript_common_functionality_1 = require("@stevenkellner/typescript-common-functionality");
8
- describe('PersonSignInProperties', () => {
9
- describe('PersonSignInProperties constructor', () => {
10
- it('should create sign-in properties with all parameters', () => {
11
- const userId = User_1.User.Id.builder.build('user-123');
12
- const joinDate = typescript_common_functionality_1.UtcDate.now;
13
- const notificationProperties = new NotificationProperties_1.NotificationProperties();
14
- const roles = ['person-manager', 'fine-manager'];
15
- const props = new PersonSignInProperties_1.PersonSignInProperties(userId, joinDate, notificationProperties, roles);
16
- (0, core_1.expect)(props.userId).toBeEqual(userId);
17
- (0, core_1.expect)(props.joinDate).toBeEqual(joinDate);
18
- (0, core_1.expect)(props.notificationProperties).toBeEqual(notificationProperties);
19
- (0, core_1.expect)(props.roles.length).toBeEqual(2);
20
- });
21
- it('should create sign-in properties with default notification properties and empty roles', () => {
22
- const userId = User_1.User.Id.builder.build('user-456');
23
- const joinDate = typescript_common_functionality_1.UtcDate.now;
24
- const props = new PersonSignInProperties_1.PersonSignInProperties(userId, joinDate);
25
- (0, core_1.expect)(props.userId).toBeEqual(userId);
26
- (0, core_1.expect)(props.joinDate).toBeEqual(joinDate);
27
- (0, core_1.expect)(props.notificationProperties).not.toBeUndefined();
28
- (0, core_1.expect)(props.roles.length).toBeEqual(0);
29
- });
30
- it('should create sign-in properties with custom notification properties but no roles', () => {
31
- const userId = User_1.User.Id.builder.build('user-789');
32
- const joinDate = typescript_common_functionality_1.UtcDate.now;
33
- const notificationProperties = new NotificationProperties_1.NotificationProperties();
34
- const props = new PersonSignInProperties_1.PersonSignInProperties(userId, joinDate, notificationProperties);
35
- (0, core_1.expect)(props.notificationProperties).toBeEqual(notificationProperties);
36
- (0, core_1.expect)(props.roles.length).toBeEqual(0);
37
- });
38
- it('should create sign-in properties with multiple roles', () => {
39
- const userId = User_1.User.Id.builder.build('user-multi');
40
- const joinDate = typescript_common_functionality_1.UtcDate.now;
41
- const roles = ['person-manager', 'fineTemplate-manager', 'fine-manager', 'team-manager'];
42
- const props = new PersonSignInProperties_1.PersonSignInProperties(userId, joinDate, new NotificationProperties_1.NotificationProperties(), roles);
43
- (0, core_1.expect)(props.roles.length).toBeEqual(4);
44
- (0, core_1.expect)(props.roles.includes('person-manager')).toBeTrue();
45
- (0, core_1.expect)(props.roles.includes('team-manager')).toBeTrue();
46
- });
47
- it('should create sign-in properties with different sign-in dates', () => {
48
- const userId = User_1.User.Id.builder.build('user-date');
49
- const date1 = typescript_common_functionality_1.UtcDate.now;
50
- const date2 = typescript_common_functionality_1.UtcDate.now;
51
- const props1 = new PersonSignInProperties_1.PersonSignInProperties(userId, date1);
52
- const props2 = new PersonSignInProperties_1.PersonSignInProperties(userId, date2);
53
- // Both should have valid dates
54
- (0, core_1.expect)(props1.joinDate).not.toBeUndefined();
55
- (0, core_1.expect)(props2.joinDate).not.toBeUndefined();
56
- });
57
- });
58
- describe('PersonSignInProperties.flatten', () => {
59
- it('should return flattened representation with all properties', () => {
60
- const userId = User_1.User.Id.builder.build('user-flat-1');
61
- const joinDate = typescript_common_functionality_1.UtcDate.now;
62
- const notificationProperties = new NotificationProperties_1.NotificationProperties();
63
- const roles = ['fine-manager', 'fine-can-add'];
64
- const props = new PersonSignInProperties_1.PersonSignInProperties(userId, joinDate, notificationProperties, roles);
65
- const flattened = props.flatten;
66
- (0, core_1.expect)(flattened.userId).toBeEqual('user-flat-1');
67
- (0, core_1.expect)(flattened.joinDate).toBeEqual(joinDate.flatten);
68
- (0, core_1.expect)(flattened.notificationProperties).not.toBeUndefined();
69
- (0, core_1.expect)(flattened.roles.length).toBeEqual(2);
70
- });
71
- it('should return flattened representation with default values', () => {
72
- const userId = User_1.User.Id.builder.build('user-flat-2');
73
- const joinDate = typescript_common_functionality_1.UtcDate.now;
74
- const props = new PersonSignInProperties_1.PersonSignInProperties(userId, joinDate);
75
- const flattened = props.flatten;
76
- (0, core_1.expect)(flattened.userId).toBeEqual('user-flat-2');
77
- (0, core_1.expect)(flattened.notificationProperties).not.toBeUndefined();
78
- (0, core_1.expect)(flattened.roles.length).toBeEqual(0);
79
- });
80
- it('should match the original values', () => {
81
- const userId = User_1.User.Id.builder.build('user-match');
82
- const joinDate = typescript_common_functionality_1.UtcDate.now;
83
- const roles = ['person-manager'];
84
- const props = new PersonSignInProperties_1.PersonSignInProperties(userId, joinDate, new NotificationProperties_1.NotificationProperties(), roles);
85
- const flattened = props.flatten;
86
- (0, core_1.expect)(flattened.userId).toBeEqual(userId.flatten);
87
- (0, core_1.expect)(flattened.joinDate).toBeEqual(joinDate.flatten);
88
- (0, core_1.expect)(flattened.roles).toBeEqual(roles);
89
- });
90
- it('should have correct structure', () => {
91
- const userId = User_1.User.Id.builder.build('user-struct');
92
- const joinDate = typescript_common_functionality_1.UtcDate.now;
93
- const props = new PersonSignInProperties_1.PersonSignInProperties(userId, joinDate);
94
- const flattened = props.flatten;
95
- (0, core_1.expect)(typeof flattened.userId).toBeEqual('string');
96
- (0, core_1.expect)(typeof flattened.joinDate).toBeEqual('string');
97
- (0, core_1.expect)(typeof flattened.notificationProperties).toBeEqual('object');
98
- (0, core_1.expect)(Array.isArray(flattened.roles)).toBeTrue();
99
- });
100
- it('should flatten roles array correctly', () => {
101
- const userId = User_1.User.Id.builder.build('user-roles');
102
- const joinDate = typescript_common_functionality_1.UtcDate.now;
103
- const roles = ['person-manager', 'fine-manager', 'team-manager'];
104
- const props = new PersonSignInProperties_1.PersonSignInProperties(userId, joinDate, new NotificationProperties_1.NotificationProperties(), roles);
105
- const flattened = props.flatten;
106
- (0, core_1.expect)(flattened.roles.length).toBeEqual(3);
107
- (0, core_1.expect)(flattened.roles[0]).toBeEqual('person-manager');
108
- (0, core_1.expect)(flattened.roles[1]).toBeEqual('fine-manager');
109
- (0, core_1.expect)(flattened.roles[2]).toBeEqual('team-manager');
110
- });
111
- });
112
- describe('PersonSignInProperties.TypeBuilder', () => {
113
- it('should build sign-in properties from flattened data with all fields', () => {
114
- const flattened = {
115
- userId: 'user-build-1',
116
- joinDate: typescript_common_functionality_1.UtcDate.now.flatten,
117
- notificationProperties: {
118
- tokens: {},
119
- subscriptions: []
120
- },
121
- roles: ['person-manager', 'fine-manager']
122
- };
123
- const props = PersonSignInProperties_1.PersonSignInProperties.builder.build(flattened);
124
- (0, core_1.expect)(props.userId.flatten).toBeEqual('user-build-1');
125
- (0, core_1.expect)(props.roles.length).toBeEqual(2);
126
- (0, core_1.expect)(props.roles[0]).toBeEqual('person-manager');
127
- });
128
- it('should build sign-in properties from flattened data with empty roles', () => {
129
- const flattened = {
130
- userId: 'user-build-2',
131
- joinDate: typescript_common_functionality_1.UtcDate.now.flatten,
132
- notificationProperties: {
133
- tokens: {},
134
- subscriptions: []
135
- },
136
- roles: []
137
- };
138
- const props = PersonSignInProperties_1.PersonSignInProperties.builder.build(flattened);
139
- (0, core_1.expect)(props.userId.flatten).toBeEqual('user-build-2');
140
- (0, core_1.expect)(props.roles.length).toBeEqual(0);
141
- });
142
- it('should build sign-in properties with various roles', () => {
143
- const flattened = {
144
- userId: 'user-build-3',
145
- joinDate: typescript_common_functionality_1.UtcDate.now.flatten,
146
- notificationProperties: {
147
- tokens: {},
148
- subscriptions: []
149
- },
150
- roles: ['person-manager', 'fineTemplate-manager', 'fine-can-add', 'team-manager']
151
- };
152
- const props = PersonSignInProperties_1.PersonSignInProperties.builder.build(flattened);
153
- (0, core_1.expect)(props.roles.length).toBeEqual(4);
154
- (0, core_1.expect)(props.roles.includes('person-manager')).toBeTrue();
155
- (0, core_1.expect)(props.roles.includes('team-manager')).toBeTrue();
156
- });
157
- it('should round-trip through flatten and build', () => {
158
- const userId = User_1.User.Id.builder.build('user-round');
159
- const joinDate = typescript_common_functionality_1.UtcDate.now;
160
- const roles = ['fine-manager', 'fine-can-add'];
161
- const original = new PersonSignInProperties_1.PersonSignInProperties(userId, joinDate, new NotificationProperties_1.NotificationProperties(), roles);
162
- const rebuilt = PersonSignInProperties_1.PersonSignInProperties.builder.build(original.flatten);
163
- (0, core_1.expect)(rebuilt.userId.flatten).toBeEqual(original.userId.flatten);
164
- (0, core_1.expect)(rebuilt.joinDate.flatten).toBeEqual(original.joinDate.flatten);
165
- (0, core_1.expect)(rebuilt.roles.length).toBeEqual(original.roles.length);
166
- (0, core_1.expect)(rebuilt.roles).toBeEqual(original.roles);
167
- });
168
- it('should round-trip through flatten and build with empty roles', () => {
169
- const userId = User_1.User.Id.builder.build('user-round-empty');
170
- const joinDate = typescript_common_functionality_1.UtcDate.now;
171
- const original = new PersonSignInProperties_1.PersonSignInProperties(userId, joinDate);
172
- const rebuilt = PersonSignInProperties_1.PersonSignInProperties.builder.build(original.flatten);
173
- (0, core_1.expect)(rebuilt.userId.flatten).toBeEqual(original.userId.flatten);
174
- (0, core_1.expect)(rebuilt.roles.length).toBeEqual(0);
175
- });
176
- it('should preserve notification properties through round-trip', () => {
177
- const userId = User_1.User.Id.builder.build('user-notif');
178
- const joinDate = typescript_common_functionality_1.UtcDate.now;
179
- const notificationProperties = new NotificationProperties_1.NotificationProperties();
180
- const original = new PersonSignInProperties_1.PersonSignInProperties(userId, joinDate, notificationProperties, []);
181
- const rebuilt = PersonSignInProperties_1.PersonSignInProperties.builder.build(original.flatten);
182
- (0, core_1.expect)(rebuilt.notificationProperties).not.toBeUndefined();
183
- (0, core_1.expect)(rebuilt.notificationProperties.tokens.values.length).toBeEqual(0);
184
- (0, core_1.expect)(rebuilt.notificationProperties.subscriptions.length).toBeEqual(0);
185
- });
186
- it('should build with different date values', () => {
187
- const testDateStrings = [
188
- '2020-01-01T00:00:00.000Z',
189
- '2024-06-15T12:30:45.000Z',
190
- '2025-12-31T23:59:59.000Z'
191
- ];
192
- testDateStrings.forEach(dateString => {
193
- const flattened = {
194
- userId: 'user-date-test',
195
- joinDate: dateString,
196
- notificationProperties: {
197
- tokens: {},
198
- subscriptions: []
199
- },
200
- roles: []
201
- };
202
- const props = PersonSignInProperties_1.PersonSignInProperties.builder.build(flattened);
203
- (0, core_1.expect)(props.joinDate).not.toBeUndefined();
204
- (0, core_1.expect)(typeof props.joinDate.flatten).toBeEqual('string');
205
- });
206
- });
207
- });
208
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,206 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const core_1 = require("@assertive-ts/core");
4
- const Pluralization_1 = require("../../src/types/Pluralization");
5
- describe('Pluralization', () => {
6
- describe('Pluralization constructor', () => {
7
- it('should create pluralization with only other form', () => {
8
- const plural = new Pluralization_1.Pluralization({
9
- other: 'items'
10
- });
11
- (0, core_1.expect)(plural.get(10)).toBeEqual('items');
12
- });
13
- it('should create pluralization with all forms', () => {
14
- const plural = new Pluralization_1.Pluralization({
15
- zero: 'no items',
16
- one: 'one item',
17
- two: 'two items',
18
- few: 'few items',
19
- many: 'many items',
20
- other: 'some items'
21
- });
22
- (0, core_1.expect)(plural.get(0)).toBeEqual('no items');
23
- });
24
- });
25
- describe('Pluralization.get with zero form', () => {
26
- it('should return zero form for count = 0', () => {
27
- const plural = new Pluralization_1.Pluralization({
28
- zero: 'no items',
29
- other: 'items'
30
- });
31
- (0, core_1.expect)(plural.get(0)).toBeEqual('no items');
32
- });
33
- it('should return other form for count = 0 when zero not defined', () => {
34
- const plural = new Pluralization_1.Pluralization({
35
- other: 'items'
36
- });
37
- (0, core_1.expect)(plural.get(0)).toBeEqual('items');
38
- });
39
- });
40
- describe('Pluralization.get with one form', () => {
41
- it('should return one form for count = 1', () => {
42
- const plural = new Pluralization_1.Pluralization({
43
- one: 'one item',
44
- other: 'items'
45
- });
46
- (0, core_1.expect)(plural.get(1)).toBeEqual('one item');
47
- });
48
- it('should return other form for count = 1 when one not defined', () => {
49
- const plural = new Pluralization_1.Pluralization({
50
- other: 'items'
51
- });
52
- (0, core_1.expect)(plural.get(1)).toBeEqual('items');
53
- });
54
- });
55
- describe('Pluralization.get with two form', () => {
56
- it('should return two form for count = 2', () => {
57
- const plural = new Pluralization_1.Pluralization({
58
- two: 'two items',
59
- other: 'items'
60
- });
61
- (0, core_1.expect)(plural.get(2)).toBeEqual('two items');
62
- });
63
- it('should return other form for count = 2 when two not defined', () => {
64
- const plural = new Pluralization_1.Pluralization({
65
- other: 'items'
66
- });
67
- (0, core_1.expect)(plural.get(2)).toBeEqual('items');
68
- });
69
- });
70
- describe('Pluralization.get with few form', () => {
71
- it('should return few form for count = 3', () => {
72
- const plural = new Pluralization_1.Pluralization({
73
- few: 'few items',
74
- other: 'items'
75
- });
76
- (0, core_1.expect)(plural.get(3)).toBeEqual('few items');
77
- });
78
- it('should return few form for count = 4', () => {
79
- const plural = new Pluralization_1.Pluralization({
80
- few: 'few items',
81
- other: 'items'
82
- });
83
- (0, core_1.expect)(plural.get(4)).toBeEqual('few items');
84
- });
85
- it('should return other form for count = 3 when few not defined', () => {
86
- const plural = new Pluralization_1.Pluralization({
87
- other: 'items'
88
- });
89
- (0, core_1.expect)(plural.get(3)).toBeEqual('items');
90
- });
91
- it('should not use few form for count = 1', () => {
92
- const plural = new Pluralization_1.Pluralization({
93
- few: 'few items',
94
- other: 'items'
95
- });
96
- (0, core_1.expect)(plural.get(1)).toBeEqual('items');
97
- });
98
- it('should use few form for count = 2 when two form not defined', () => {
99
- const plural = new Pluralization_1.Pluralization({
100
- few: 'few items',
101
- other: 'items'
102
- });
103
- (0, core_1.expect)(plural.get(2)).toBeEqual('few items');
104
- });
105
- it('should not use few form for count = 5', () => {
106
- const plural = new Pluralization_1.Pluralization({
107
- few: 'few items',
108
- other: 'items'
109
- });
110
- (0, core_1.expect)(plural.get(5)).toBeEqual('items');
111
- });
112
- });
113
- describe('Pluralization.get with many form', () => {
114
- it('should return many form for count = 5', () => {
115
- const plural = new Pluralization_1.Pluralization({
116
- many: 'many items',
117
- other: 'items'
118
- });
119
- (0, core_1.expect)(plural.get(5)).toBeEqual('many items');
120
- });
121
- it('should return many form for count = 10', () => {
122
- const plural = new Pluralization_1.Pluralization({
123
- many: 'many items',
124
- other: 'items'
125
- });
126
- (0, core_1.expect)(plural.get(10)).toBeEqual('many items');
127
- });
128
- it('should return many form for count = 20', () => {
129
- const plural = new Pluralization_1.Pluralization({
130
- many: 'many items',
131
- other: 'items'
132
- });
133
- (0, core_1.expect)(plural.get(20)).toBeEqual('many items');
134
- });
135
- it('should return other form for count = 5 when many not defined', () => {
136
- const plural = new Pluralization_1.Pluralization({
137
- other: 'items'
138
- });
139
- (0, core_1.expect)(plural.get(5)).toBeEqual('items');
140
- });
141
- it('should not use many form for count = 4', () => {
142
- const plural = new Pluralization_1.Pluralization({
143
- many: 'many items',
144
- other: 'items'
145
- });
146
- (0, core_1.expect)(plural.get(4)).toBeEqual('items');
147
- });
148
- it('should not use many form for count = 21', () => {
149
- const plural = new Pluralization_1.Pluralization({
150
- many: 'many items',
151
- other: 'items'
152
- });
153
- (0, core_1.expect)(plural.get(21)).toBeEqual('items');
154
- });
155
- });
156
- describe('Pluralization.get with other form', () => {
157
- it('should return other form for large count', () => {
158
- const plural = new Pluralization_1.Pluralization({
159
- other: 'items'
160
- });
161
- (0, core_1.expect)(plural.get(100)).toBeEqual('items');
162
- });
163
- it('should return other form when no specific form matches', () => {
164
- const plural = new Pluralization_1.Pluralization({
165
- zero: 'no items',
166
- one: 'one item',
167
- other: 'items'
168
- });
169
- (0, core_1.expect)(plural.get(50)).toBeEqual('items');
170
- });
171
- });
172
- describe('Pluralization.get with all forms defined', () => {
173
- it('should select correct form based on priority', () => {
174
- const plural = new Pluralization_1.Pluralization({
175
- zero: 'zero',
176
- one: 'one',
177
- two: 'two',
178
- few: 'few',
179
- many: 'many',
180
- other: 'other'
181
- });
182
- (0, core_1.expect)(plural.get(0)).toBeEqual('zero');
183
- (0, core_1.expect)(plural.get(1)).toBeEqual('one');
184
- (0, core_1.expect)(plural.get(2)).toBeEqual('two');
185
- (0, core_1.expect)(plural.get(3)).toBeEqual('few');
186
- (0, core_1.expect)(plural.get(4)).toBeEqual('few');
187
- (0, core_1.expect)(plural.get(5)).toBeEqual('many');
188
- (0, core_1.expect)(plural.get(10)).toBeEqual('many');
189
- (0, core_1.expect)(plural.get(20)).toBeEqual('many');
190
- (0, core_1.expect)(plural.get(21)).toBeEqual('other');
191
- (0, core_1.expect)(plural.get(100)).toBeEqual('other');
192
- });
193
- });
194
- describe('Pluralization.get with template strings', () => {
195
- it('should handle template-style strings', () => {
196
- const plural = new Pluralization_1.Pluralization({
197
- zero: 'You have no messages',
198
- one: 'You have {{count}} message',
199
- other: 'You have {{count}} messages'
200
- });
201
- (0, core_1.expect)(plural.get(0)).toBeEqual('You have no messages');
202
- (0, core_1.expect)(plural.get(1)).toBeEqual('You have {{count}} message');
203
- (0, core_1.expect)(plural.get(5)).toBeEqual('You have {{count}} messages');
204
- });
205
- });
206
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,145 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const core_1 = require("@assertive-ts/core");
4
- const Team_1 = require("../../src/types/Team");
5
- const typescript_common_functionality_1 = require("@stevenkellner/typescript-common-functionality");
6
- describe('Team', () => {
7
- describe('Team.Id', () => {
8
- describe('Team.Id type', () => {
9
- it('should create a valid team ID', () => {
10
- const guidString = typescript_common_functionality_1.Guid.generate().guidString;
11
- const teamId = Team_1.Team.Id.builder.build(guidString);
12
- (0, core_1.expect)(teamId.value.guidString).toBeEqual(guidString);
13
- });
14
- });
15
- describe('Team.Id.builder', () => {
16
- it('should build team ID from GUID string', () => {
17
- const guidString = 'a2345678-1234-4234-1234-123456789abc';
18
- const teamId = Team_1.Team.Id.builder.build(guidString);
19
- (0, core_1.expect)(teamId.value.guidString).toBeEqual(guidString);
20
- });
21
- it('should preserve team ID value', () => {
22
- const guidString = 'abcdef01-3456-4890-abcd-ef1234567890';
23
- const teamId = Team_1.Team.Id.builder.build(guidString);
24
- (0, core_1.expect)(teamId.flatten).toBeEqual(guidString);
25
- });
26
- });
27
- });
28
- describe('Team', () => {
29
- describe('Team constructor', () => {
30
- it('should create a team with ID, name, and PayPal link', () => {
31
- const teamId = Team_1.Team.Id.builder.build(typescript_common_functionality_1.Guid.generate().guidString);
32
- const team = new Team_1.Team(teamId, 'Alpha Team', 'https://paypal.me/alphateam');
33
- (0, core_1.expect)(team.id).toBeEqual(teamId);
34
- (0, core_1.expect)(team.name).toBeEqual('Alpha Team');
35
- (0, core_1.expect)(team.paypalMeLink).toBeEqual('https://paypal.me/alphateam');
36
- });
37
- it('should create a team without PayPal link', () => {
38
- const teamId = Team_1.Team.Id.builder.build(typescript_common_functionality_1.Guid.generate().guidString);
39
- const team = new Team_1.Team(teamId, 'Beta Team', null);
40
- (0, core_1.expect)(team.id).toBeEqual(teamId);
41
- (0, core_1.expect)(team.name).toBeEqual('Beta Team');
42
- (0, core_1.expect)(team.paypalMeLink).toBeNull();
43
- });
44
- it('should create teams with different names', () => {
45
- const teamId1 = Team_1.Team.Id.builder.build(typescript_common_functionality_1.Guid.generate().guidString);
46
- const teamId2 = Team_1.Team.Id.builder.build(typescript_common_functionality_1.Guid.generate().guidString);
47
- const team1 = new Team_1.Team(teamId1, 'Team One', null);
48
- const team2 = new Team_1.Team(teamId2, 'Team Two', 'https://paypal.me/team2');
49
- (0, core_1.expect)(team1.name).toBeEqual('Team One');
50
- (0, core_1.expect)(team2.name).toBeEqual('Team Two');
51
- });
52
- });
53
- describe('Team.flatten', () => {
54
- it('should return flattened representation with PayPal link', () => {
55
- const guidString = 'a1111111-1111-4111-1111-111111111111';
56
- const teamId = Team_1.Team.Id.builder.build(guidString);
57
- const team = new Team_1.Team(teamId, 'Flatten Team', 'https://paypal.me/flattenteam');
58
- const flattened = team.flatten;
59
- (0, core_1.expect)(flattened.id).toBeEqual(guidString);
60
- (0, core_1.expect)(flattened.name).toBeEqual('Flatten Team');
61
- (0, core_1.expect)(flattened.paypalMeLink).toBeEqual('https://paypal.me/flattenteam');
62
- });
63
- it('should return flattened representation without PayPal link', () => {
64
- const guidString = 'a2222222-2222-4222-2222-222222222222';
65
- const teamId = Team_1.Team.Id.builder.build(guidString);
66
- const team = new Team_1.Team(teamId, 'No PayPal Team', null);
67
- const flattened = team.flatten;
68
- (0, core_1.expect)(flattened.id).toBeEqual(guidString);
69
- (0, core_1.expect)(flattened.name).toBeEqual('No PayPal Team');
70
- (0, core_1.expect)(flattened.paypalMeLink).toBeNull();
71
- });
72
- it('should match the original values', () => {
73
- const teamId = Team_1.Team.Id.builder.build(typescript_common_functionality_1.Guid.generate().guidString);
74
- const name = 'Match Team';
75
- const paypalLink = 'https://paypal.me/match';
76
- const team = new Team_1.Team(teamId, name, paypalLink);
77
- const flattened = team.flatten;
78
- (0, core_1.expect)(flattened.id).toBeEqual(teamId.flatten);
79
- (0, core_1.expect)(flattened.name).toBeEqual(name);
80
- (0, core_1.expect)(flattened.paypalMeLink).toBeEqual(paypalLink);
81
- });
82
- it('should have correct structure', () => {
83
- const teamId = Team_1.Team.Id.builder.build(typescript_common_functionality_1.Guid.generate().guidString);
84
- const team = new Team_1.Team(teamId, 'Structure Team', null);
85
- const flattened = team.flatten;
86
- (0, core_1.expect)(typeof flattened.id).toBeEqual('string');
87
- (0, core_1.expect)(typeof flattened.name).toBeEqual('string');
88
- (0, core_1.expect)(flattened.paypalMeLink).toBeNull();
89
- });
90
- });
91
- describe('Team.TypeBuilder', () => {
92
- it('should build team from flattened data with PayPal link', () => {
93
- const flattened = {
94
- id: 'a3333333-3333-4333-3333-333333333333',
95
- name: 'Built Team',
96
- paypalMeLink: 'https://paypal.me/builtteam'
97
- };
98
- const team = Team_1.Team.builder.build(flattened);
99
- (0, core_1.expect)(team.id.value.guidString).toBeEqual('a3333333-3333-4333-3333-333333333333');
100
- (0, core_1.expect)(team.name).toBeEqual('Built Team');
101
- (0, core_1.expect)(team.paypalMeLink).toBeEqual('https://paypal.me/builtteam');
102
- });
103
- it('should build team from flattened data without PayPal link', () => {
104
- const flattened = {
105
- id: 'a4444444-4444-4444-4444-444444444444',
106
- name: 'No Link Team',
107
- paypalMeLink: null
108
- };
109
- const team = Team_1.Team.builder.build(flattened);
110
- (0, core_1.expect)(team.id.value.guidString).toBeEqual('a4444444-4444-4444-4444-444444444444');
111
- (0, core_1.expect)(team.name).toBeEqual('No Link Team');
112
- (0, core_1.expect)(team.paypalMeLink).toBeNull();
113
- });
114
- it('should round-trip through flatten and build with PayPal link', () => {
115
- const teamId = Team_1.Team.Id.builder.build('a5555555-5555-4555-5555-555555555555');
116
- const original = new Team_1.Team(teamId, 'Round Trip Team', 'https://paypal.me/roundtrip');
117
- const rebuilt = Team_1.Team.builder.build(original.flatten);
118
- (0, core_1.expect)(rebuilt.id.flatten).toBeEqual(original.id.flatten);
119
- (0, core_1.expect)(rebuilt.name).toBeEqual(original.name);
120
- (0, core_1.expect)(rebuilt.paypalMeLink).toBeEqual(original.paypalMeLink);
121
- });
122
- it('should round-trip through flatten and build without PayPal link', () => {
123
- const teamId = Team_1.Team.Id.builder.build('a6666666-6666-4666-6666-666666666666');
124
- const original = new Team_1.Team(teamId, 'Null Link Team', null);
125
- const rebuilt = Team_1.Team.builder.build(original.flatten);
126
- (0, core_1.expect)(rebuilt.id.flatten).toBeEqual(original.id.flatten);
127
- (0, core_1.expect)(rebuilt.name).toBeEqual(original.name);
128
- (0, core_1.expect)(rebuilt.paypalMeLink).toBeNull();
129
- });
130
- it('should build teams with various valid inputs', () => {
131
- const testCases = [
132
- { id: 'a7777777-7777-4777-7777-777777777777', name: 'Test 1', paypalMeLink: 'https://paypal.me/test1' },
133
- { id: 'a8888888-8888-4888-8888-888888888888', name: 'Test 2', paypalMeLink: null },
134
- { id: 'a9999999-9999-4999-9999-999999999999', name: 'Team with Long Name', paypalMeLink: 'https://paypal.me/longname' }
135
- ];
136
- testCases.forEach(testCase => {
137
- const team = Team_1.Team.builder.build(testCase);
138
- (0, core_1.expect)(team.id.value.guidString).toBeEqual(testCase.id);
139
- (0, core_1.expect)(team.name).toBeEqual(testCase.name);
140
- (0, core_1.expect)(team.paypalMeLink).toBeEqual(testCase.paypalMeLink);
141
- });
142
- });
143
- });
144
- });
145
- });
@@ -1 +0,0 @@
1
- export {};