@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,266 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@assertive-ts/core");
4
+ const Person_1 = require("../../src/types/Person");
5
+ const PersonPrivateProperties_1 = require("../../src/types/PersonPrivateProperties");
6
+ const PersonSignInProperties_1 = require("../../src/types/PersonSignInProperties");
7
+ const NotificationProperties_1 = require("../../src/types/NotificationProperties");
8
+ const Fine_1 = require("../../src/types/Fine");
9
+ const typescript_common_functionality_1 = require("@stevenkellner/typescript-common-functionality");
10
+ const User_1 = require("../../src/types/User");
11
+ describe('Person', () => {
12
+ describe('Person.Id', () => {
13
+ describe('Person.Id type', () => {
14
+ it('should create a valid person ID', () => {
15
+ const guid = new typescript_common_functionality_1.Guid('a1234567-89ab-4def-0123-456789abcdef');
16
+ const personId = Person_1.Person.Id.builder.build(guid.guidString);
17
+ (0, core_1.expect)(personId.value).toBeEqual(guid);
18
+ });
19
+ });
20
+ describe('Person.Id.builder', () => {
21
+ it('should build person ID from GUID string', () => {
22
+ const guidString = 'a1234567-89ab-4def-0123-456789abcdef';
23
+ const personId = Person_1.Person.Id.builder.build(guidString);
24
+ (0, core_1.expect)(personId.flatten).toBeEqual(guidString);
25
+ });
26
+ it('should preserve person ID value', () => {
27
+ const guidString = 'b2345678-9abc-4ef0-1234-56789abcdef0';
28
+ const personId = Person_1.Person.Id.builder.build(guidString);
29
+ (0, core_1.expect)(personId.flatten).toBeEqual(guidString);
30
+ });
31
+ });
32
+ });
33
+ describe('Person', () => {
34
+ describe('Person constructor', () => {
35
+ it('should create a person with all properties', () => {
36
+ const userId = User_1.User.Id.builder.build('u1234567-89ab-4def-0123-456789abcdef');
37
+ const personId = Person_1.Person.Id.builder.build('a1111111-1111-4111-1111-111111111111');
38
+ const properties = new PersonPrivateProperties_1.PersonPrivateProperties('John', 'Doe');
39
+ const fineIds = [Fine_1.Fine.Id.builder.build('b2222222-2222-4222-2222-222222222222')];
40
+ const signInProperties = new PersonSignInProperties_1.PersonSignInProperties(userId, typescript_common_functionality_1.UtcDate.now, new NotificationProperties_1.NotificationProperties(), []);
41
+ const person = new Person_1.Person(personId, properties, fineIds, signInProperties);
42
+ (0, core_1.expect)(person.id).toBeEqual(personId);
43
+ (0, core_1.expect)(person.properties).toBeEqual(properties);
44
+ (0, core_1.expect)(person.fineIds.length).toBeEqual(1);
45
+ (0, core_1.expect)(person.signInProperties).toBeEqual(signInProperties);
46
+ });
47
+ it('should create a person with default empty fineIds', () => {
48
+ const personId = Person_1.Person.Id.builder.build('a1111111-1111-4111-1111-111111111111');
49
+ const properties = new PersonPrivateProperties_1.PersonPrivateProperties('Jane', null);
50
+ const person = new Person_1.Person(personId, properties);
51
+ (0, core_1.expect)(person.fineIds.length).toBeEqual(0);
52
+ (0, core_1.expect)(person.signInProperties).toBeEqual(null);
53
+ });
54
+ it('should create a person without sign-in properties', () => {
55
+ const personId = Person_1.Person.Id.builder.build('a1111111-1111-4111-1111-111111111111');
56
+ const properties = new PersonPrivateProperties_1.PersonPrivateProperties('Alice', 'Smith');
57
+ const fineIds = [];
58
+ const person = new Person_1.Person(personId, properties, fineIds, null);
59
+ (0, core_1.expect)(person.signInProperties).toBeEqual(null);
60
+ });
61
+ it('should create a person with multiple fines', () => {
62
+ const personId = Person_1.Person.Id.builder.build('a1111111-1111-4111-1111-111111111111');
63
+ const properties = new PersonPrivateProperties_1.PersonPrivateProperties('Bob', null);
64
+ const fineIds = [
65
+ Fine_1.Fine.Id.builder.build('b2222222-2222-4222-2222-222222222222'),
66
+ Fine_1.Fine.Id.builder.build('c3333333-3333-4333-3333-333333333333'),
67
+ Fine_1.Fine.Id.builder.build('d4444444-4444-4444-4444-444444444444')
68
+ ];
69
+ const person = new Person_1.Person(personId, properties, fineIds);
70
+ (0, core_1.expect)(person.fineIds.length).toBeEqual(3);
71
+ });
72
+ it('should handle person with only first name', () => {
73
+ const personId = Person_1.Person.Id.builder.build('a1111111-1111-4111-1111-111111111111');
74
+ const properties = new PersonPrivateProperties_1.PersonPrivateProperties('Charlie', null);
75
+ const person = new Person_1.Person(personId, properties);
76
+ (0, core_1.expect)(person.properties.lastName).toBeEqual(null);
77
+ });
78
+ });
79
+ describe('Person.name', () => {
80
+ it('should return full name when last name is present', () => {
81
+ const personId = Person_1.Person.Id.builder.build('a1111111-1111-4111-1111-111111111111');
82
+ const properties = new PersonPrivateProperties_1.PersonPrivateProperties('John', 'Doe');
83
+ const person = new Person_1.Person(personId, properties);
84
+ (0, core_1.expect)(person.name).toBeEqual('John Doe');
85
+ });
86
+ it('should return only first name when last name is null', () => {
87
+ const personId = Person_1.Person.Id.builder.build('a1111111-1111-4111-1111-111111111111');
88
+ const properties = new PersonPrivateProperties_1.PersonPrivateProperties('Jane', null);
89
+ const person = new Person_1.Person(personId, properties);
90
+ (0, core_1.expect)(person.name).toBeEqual('Jane');
91
+ });
92
+ it('should handle names with special characters', () => {
93
+ const personId = Person_1.Person.Id.builder.build('a1111111-1111-4111-1111-111111111111');
94
+ const properties = new PersonPrivateProperties_1.PersonPrivateProperties('José', 'García');
95
+ const person = new Person_1.Person(personId, properties);
96
+ (0, core_1.expect)(person.name).toBeEqual('José García');
97
+ });
98
+ it('should format name correctly with spaces', () => {
99
+ const personId = Person_1.Person.Id.builder.build('a1111111-1111-4111-1111-111111111111');
100
+ const properties = new PersonPrivateProperties_1.PersonPrivateProperties('Alice', 'Smith');
101
+ const person = new Person_1.Person(personId, properties);
102
+ const nameParts = person.name.split(' ');
103
+ (0, core_1.expect)(nameParts.length).toBeEqual(2);
104
+ (0, core_1.expect)(nameParts[0]).toBeEqual('Alice');
105
+ (0, core_1.expect)(nameParts[1]).toBeEqual('Smith');
106
+ });
107
+ });
108
+ describe('Person.flatten', () => {
109
+ it('should return flattened representation with all properties', () => {
110
+ const userId = User_1.User.Id.builder.build('u1234567-89ab-4def-0123-456789abcdef');
111
+ const personId = Person_1.Person.Id.builder.build('a1111111-1111-4111-1111-111111111111');
112
+ const properties = new PersonPrivateProperties_1.PersonPrivateProperties('John', 'Doe');
113
+ const fineIds = [Fine_1.Fine.Id.builder.build('b2222222-2222-4222-2222-222222222222')];
114
+ const signInProperties = new PersonSignInProperties_1.PersonSignInProperties(userId, typescript_common_functionality_1.UtcDate.now, new NotificationProperties_1.NotificationProperties(), []);
115
+ const person = new Person_1.Person(personId, properties, fineIds, signInProperties);
116
+ const flattened = person.flatten;
117
+ (0, core_1.expect)(flattened.id).toBeEqual(personId.flatten);
118
+ (0, core_1.expect)(flattened.properties.firstName).toBeEqual('John');
119
+ (0, core_1.expect)(flattened.properties.lastName).toBeEqual('Doe');
120
+ (0, core_1.expect)(flattened.fineIds.length).toBeEqual(1);
121
+ (0, core_1.expect)(flattened.signInProperties).not.toBeEqual(null);
122
+ });
123
+ it('should return flattened representation with null sign-in properties', () => {
124
+ const personId = Person_1.Person.Id.builder.build('a1111111-1111-4111-1111-111111111111');
125
+ const properties = new PersonPrivateProperties_1.PersonPrivateProperties('Jane', null);
126
+ const person = new Person_1.Person(personId, properties);
127
+ const flattened = person.flatten;
128
+ (0, core_1.expect)(flattened.signInProperties).toBeEqual(null);
129
+ });
130
+ it('should flatten empty fineIds array', () => {
131
+ const personId = Person_1.Person.Id.builder.build('a1111111-1111-4111-1111-111111111111');
132
+ const properties = new PersonPrivateProperties_1.PersonPrivateProperties('Alice', 'Smith');
133
+ const person = new Person_1.Person(personId, properties, []);
134
+ const flattened = person.flatten;
135
+ (0, core_1.expect)(flattened.fineIds.length).toBeEqual(0);
136
+ (0, core_1.expect)(Array.isArray(flattened.fineIds)).toBeTrue();
137
+ });
138
+ it('should flatten multiple fineIds', () => {
139
+ const personId = Person_1.Person.Id.builder.build('a1111111-1111-4111-1111-111111111111');
140
+ const properties = new PersonPrivateProperties_1.PersonPrivateProperties('Bob', null);
141
+ const fineIds = [
142
+ Fine_1.Fine.Id.builder.build('b2222222-2222-4222-2222-222222222222'),
143
+ Fine_1.Fine.Id.builder.build('c3333333-3333-4333-3333-333333333333')
144
+ ];
145
+ const person = new Person_1.Person(personId, properties, fineIds);
146
+ const flattened = person.flatten;
147
+ (0, core_1.expect)(flattened.fineIds.length).toBeEqual(2);
148
+ (0, core_1.expect)(flattened.fineIds[0]).toBeEqual('b2222222-2222-4222-2222-222222222222');
149
+ (0, core_1.expect)(flattened.fineIds[1]).toBeEqual('c3333333-3333-4333-3333-333333333333');
150
+ });
151
+ it('should have correct structure', () => {
152
+ const personId = Person_1.Person.Id.builder.build('a1111111-1111-4111-1111-111111111111');
153
+ const properties = new PersonPrivateProperties_1.PersonPrivateProperties('Charlie', 'Brown');
154
+ const person = new Person_1.Person(personId, properties);
155
+ const flattened = person.flatten;
156
+ (0, core_1.expect)(typeof flattened.id).toBeEqual('string');
157
+ (0, core_1.expect)(typeof flattened.properties).toBeEqual('object');
158
+ (0, core_1.expect)(Array.isArray(flattened.fineIds)).toBeTrue();
159
+ });
160
+ });
161
+ describe('Person.TypeBuilder', () => {
162
+ it('should build person from flattened data with all properties', () => {
163
+ const flattened = {
164
+ id: 'a1111111-1111-4111-1111-111111111111',
165
+ properties: {
166
+ firstName: 'John',
167
+ lastName: 'Doe'
168
+ },
169
+ fineIds: ['b2222222-2222-4222-2222-222222222222'],
170
+ signInProperties: {
171
+ userId: 'user-123',
172
+ signInDate: typescript_common_functionality_1.UtcDate.now.flatten,
173
+ notificationProperties: {
174
+ tokens: {},
175
+ subscriptions: []
176
+ },
177
+ roles: []
178
+ }
179
+ };
180
+ const person = Person_1.Person.builder.build(flattened);
181
+ (0, core_1.expect)(person.id.flatten).toBeEqual(flattened.id);
182
+ (0, core_1.expect)(person.properties.firstName).toBeEqual('John');
183
+ (0, core_1.expect)(person.fineIds.length).toBeEqual(1);
184
+ (0, core_1.expect)(person.signInProperties).not.toBeEqual(null);
185
+ });
186
+ it('should build person from flattened data with null sign-in properties', () => {
187
+ const flattened = {
188
+ id: 'a1111111-1111-4111-1111-111111111111',
189
+ properties: {
190
+ firstName: 'Jane',
191
+ lastName: null
192
+ },
193
+ fineIds: [],
194
+ signInProperties: null
195
+ };
196
+ const person = Person_1.Person.builder.build(flattened);
197
+ (0, core_1.expect)(person.signInProperties).toBeEqual(null);
198
+ });
199
+ it('should build person with empty fineIds array', () => {
200
+ const flattened = {
201
+ id: 'a1111111-1111-4111-1111-111111111111',
202
+ properties: {
203
+ firstName: 'Alice',
204
+ lastName: 'Smith'
205
+ },
206
+ fineIds: [],
207
+ signInProperties: null
208
+ };
209
+ const person = Person_1.Person.builder.build(flattened);
210
+ (0, core_1.expect)(person.fineIds.length).toBeEqual(0);
211
+ });
212
+ it('should build person with multiple fineIds', () => {
213
+ const flattened = {
214
+ id: 'a1111111-1111-4111-1111-111111111111',
215
+ properties: {
216
+ firstName: 'Bob',
217
+ lastName: null
218
+ },
219
+ fineIds: [
220
+ 'b2222222-2222-4222-2222-222222222222',
221
+ 'c3333333-3333-4333-3333-333333333333',
222
+ 'd4444444-4444-4444-4444-444444444444'
223
+ ],
224
+ signInProperties: null
225
+ };
226
+ const person = Person_1.Person.builder.build(flattened);
227
+ (0, core_1.expect)(person.fineIds.length).toBeEqual(3);
228
+ });
229
+ it('should round-trip through flatten and build with all properties', () => {
230
+ const userId = User_1.User.Id.builder.build('u1234567-89ab-4def-0123-456789abcdef');
231
+ const personId = Person_1.Person.Id.builder.build('a1111111-1111-4111-1111-111111111111');
232
+ const properties = new PersonPrivateProperties_1.PersonPrivateProperties('John', 'Doe');
233
+ const fineIds = [Fine_1.Fine.Id.builder.build('b2222222-2222-4222-2222-222222222222')];
234
+ const signInProperties = new PersonSignInProperties_1.PersonSignInProperties(userId, typescript_common_functionality_1.UtcDate.now, new NotificationProperties_1.NotificationProperties(), []);
235
+ const original = new Person_1.Person(personId, properties, fineIds, signInProperties);
236
+ const rebuilt = Person_1.Person.builder.build(original.flatten);
237
+ (0, core_1.expect)(rebuilt.id.flatten).toBeEqual(original.id.flatten);
238
+ (0, core_1.expect)(rebuilt.properties.firstName).toBeEqual(original.properties.firstName);
239
+ (0, core_1.expect)(rebuilt.properties.lastName).toBeEqual(original.properties.lastName);
240
+ (0, core_1.expect)(rebuilt.fineIds.length).toBeEqual(original.fineIds.length);
241
+ (0, core_1.expect)(rebuilt.signInProperties).not.toBeEqual(null);
242
+ });
243
+ it('should round-trip through flatten and build with null sign-in properties', () => {
244
+ const personId = Person_1.Person.Id.builder.build('a1111111-1111-4111-1111-111111111111');
245
+ const properties = new PersonPrivateProperties_1.PersonPrivateProperties('Jane', null);
246
+ const original = new Person_1.Person(personId, properties);
247
+ const rebuilt = Person_1.Person.builder.build(original.flatten);
248
+ (0, core_1.expect)(rebuilt.signInProperties).toBeEqual(null);
249
+ });
250
+ it('should round-trip through flatten and build with empty fineIds', () => {
251
+ const personId = Person_1.Person.Id.builder.build('a1111111-1111-4111-1111-111111111111');
252
+ const properties = new PersonPrivateProperties_1.PersonPrivateProperties('Alice', 'Smith');
253
+ const original = new Person_1.Person(personId, properties, []);
254
+ const rebuilt = Person_1.Person.builder.build(original.flatten);
255
+ (0, core_1.expect)(rebuilt.fineIds.length).toBeEqual(0);
256
+ });
257
+ it('should preserve name property through round-trip', () => {
258
+ const personId = Person_1.Person.Id.builder.build('a1111111-1111-4111-1111-111111111111');
259
+ const properties = new PersonPrivateProperties_1.PersonPrivateProperties('Charlie', 'Brown');
260
+ const original = new Person_1.Person(personId, properties);
261
+ const rebuilt = Person_1.Person.builder.build(original.flatten);
262
+ (0, core_1.expect)(rebuilt.name).toBeEqual(original.name);
263
+ });
264
+ });
265
+ });
266
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,155 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@assertive-ts/core");
4
+ const PersonPrivateProperties_1 = require("../../src/types/PersonPrivateProperties");
5
+ describe('PersonPrivateProperties', () => {
6
+ describe('PersonPrivateProperties constructor', () => {
7
+ it('should create properties with first name and last name', () => {
8
+ const props = new PersonPrivateProperties_1.PersonPrivateProperties('John', 'Doe');
9
+ (0, core_1.expect)(props.firstName).toBeEqual('John');
10
+ (0, core_1.expect)(props.lastName).toBeEqual('Doe');
11
+ });
12
+ it('should create properties with first name only', () => {
13
+ const props = new PersonPrivateProperties_1.PersonPrivateProperties('Jane', null);
14
+ (0, core_1.expect)(props.firstName).toBeEqual('Jane');
15
+ (0, core_1.expect)(props.lastName).toBeNull();
16
+ });
17
+ it('should create properties with various names', () => {
18
+ const testCases = [
19
+ { firstName: 'Alice', lastName: 'Smith' },
20
+ { firstName: 'Bob', lastName: null },
21
+ { firstName: 'Charlie', lastName: 'Johnson' },
22
+ { firstName: 'Diana', lastName: 'Williams' }
23
+ ];
24
+ testCases.forEach(testCase => {
25
+ const props = new PersonPrivateProperties_1.PersonPrivateProperties(testCase.firstName, testCase.lastName);
26
+ (0, core_1.expect)(props.firstName).toBeEqual(testCase.firstName);
27
+ (0, core_1.expect)(props.lastName).toBeEqual(testCase.lastName);
28
+ });
29
+ });
30
+ it('should handle names with special characters', () => {
31
+ const props = new PersonPrivateProperties_1.PersonPrivateProperties('François', 'O\'Brien');
32
+ (0, core_1.expect)(props.firstName).toBeEqual('François');
33
+ (0, core_1.expect)(props.lastName).toBeEqual('O\'Brien');
34
+ });
35
+ it('should handle long names', () => {
36
+ const longFirstName = 'Alexander-Christopher-Maximilian';
37
+ const longLastName = 'Van Der Woodsen-Humphrey-Bass';
38
+ const props = new PersonPrivateProperties_1.PersonPrivateProperties(longFirstName, longLastName);
39
+ (0, core_1.expect)(props.firstName).toBeEqual(longFirstName);
40
+ (0, core_1.expect)(props.lastName).toBeEqual(longLastName);
41
+ });
42
+ it('should handle empty string as first name', () => {
43
+ const props = new PersonPrivateProperties_1.PersonPrivateProperties('', 'Doe');
44
+ (0, core_1.expect)(props.firstName).toBeEqual('');
45
+ (0, core_1.expect)(props.lastName).toBeEqual('Doe');
46
+ });
47
+ });
48
+ describe('PersonPrivateProperties.flatten', () => {
49
+ it('should return flattened representation with both names', () => {
50
+ const props = new PersonPrivateProperties_1.PersonPrivateProperties('John', 'Smith');
51
+ const flattened = props.flatten;
52
+ (0, core_1.expect)(flattened.firstName).toBeEqual('John');
53
+ (0, core_1.expect)(flattened.lastName).toBeEqual('Smith');
54
+ });
55
+ it('should return flattened representation with first name only', () => {
56
+ const props = new PersonPrivateProperties_1.PersonPrivateProperties('Jane', null);
57
+ const flattened = props.flatten;
58
+ (0, core_1.expect)(flattened.firstName).toBeEqual('Jane');
59
+ (0, core_1.expect)(flattened.lastName).toBeNull();
60
+ });
61
+ it('should match the original values', () => {
62
+ const firstName = 'Michael';
63
+ const lastName = 'Brown';
64
+ const props = new PersonPrivateProperties_1.PersonPrivateProperties(firstName, lastName);
65
+ const flattened = props.flatten;
66
+ (0, core_1.expect)(flattened.firstName).toBeEqual(firstName);
67
+ (0, core_1.expect)(flattened.lastName).toBeEqual(lastName);
68
+ });
69
+ it('should have correct structure', () => {
70
+ const props = new PersonPrivateProperties_1.PersonPrivateProperties('Test', 'User');
71
+ const flattened = props.flatten;
72
+ (0, core_1.expect)(typeof flattened.firstName).toBeEqual('string');
73
+ (0, core_1.expect)(typeof flattened.lastName).toBeEqual('string');
74
+ });
75
+ it('should handle null lastName correctly in flattened form', () => {
76
+ const props = new PersonPrivateProperties_1.PersonPrivateProperties('Single', null);
77
+ const flattened = props.flatten;
78
+ (0, core_1.expect)(flattened.lastName).toBeNull();
79
+ });
80
+ it('should preserve special characters in flattened form', () => {
81
+ const props = new PersonPrivateProperties_1.PersonPrivateProperties('José', 'García');
82
+ const flattened = props.flatten;
83
+ (0, core_1.expect)(flattened.firstName).toBeEqual('José');
84
+ (0, core_1.expect)(flattened.lastName).toBeEqual('García');
85
+ });
86
+ });
87
+ describe('PersonPrivateProperties.TypeBuilder', () => {
88
+ it('should build properties from flattened data with both names', () => {
89
+ const flattened = {
90
+ firstName: 'Emily',
91
+ lastName: 'Davis'
92
+ };
93
+ const props = PersonPrivateProperties_1.PersonPrivateProperties.builder.build(flattened);
94
+ (0, core_1.expect)(props.firstName).toBeEqual('Emily');
95
+ (0, core_1.expect)(props.lastName).toBeEqual('Davis');
96
+ });
97
+ it('should build properties from flattened data with null lastName', () => {
98
+ const flattened = {
99
+ firstName: 'Oliver',
100
+ lastName: null
101
+ };
102
+ const props = PersonPrivateProperties_1.PersonPrivateProperties.builder.build(flattened);
103
+ (0, core_1.expect)(props.firstName).toBeEqual('Oliver');
104
+ (0, core_1.expect)(props.lastName).toBeNull();
105
+ });
106
+ it('should round-trip through flatten and build with both names', () => {
107
+ const original = new PersonPrivateProperties_1.PersonPrivateProperties('Sophia', 'Wilson');
108
+ const rebuilt = PersonPrivateProperties_1.PersonPrivateProperties.builder.build(original.flatten);
109
+ (0, core_1.expect)(rebuilt.firstName).toBeEqual(original.firstName);
110
+ (0, core_1.expect)(rebuilt.lastName).toBeEqual(original.lastName);
111
+ });
112
+ it('should round-trip through flatten and build with null lastName', () => {
113
+ const original = new PersonPrivateProperties_1.PersonPrivateProperties('Liam', null);
114
+ const rebuilt = PersonPrivateProperties_1.PersonPrivateProperties.builder.build(original.flatten);
115
+ (0, core_1.expect)(rebuilt.firstName).toBeEqual(original.firstName);
116
+ (0, core_1.expect)(rebuilt.lastName).toBeNull();
117
+ });
118
+ it('should build properties with various names', () => {
119
+ const testCases = [
120
+ { firstName: 'Emma', lastName: 'Taylor' },
121
+ { firstName: 'Noah', lastName: null },
122
+ { firstName: 'Ava', lastName: 'Anderson' },
123
+ { firstName: 'William', lastName: 'Thomas' }
124
+ ];
125
+ testCases.forEach(testCase => {
126
+ const props = PersonPrivateProperties_1.PersonPrivateProperties.builder.build(testCase);
127
+ (0, core_1.expect)(props.firstName).toBeEqual(testCase.firstName);
128
+ (0, core_1.expect)(props.lastName).toBeEqual(testCase.lastName);
129
+ });
130
+ });
131
+ it('should handle special characters through round-trip', () => {
132
+ const original = new PersonPrivateProperties_1.PersonPrivateProperties('Müller', 'O\'Reilly');
133
+ const rebuilt = PersonPrivateProperties_1.PersonPrivateProperties.builder.build(original.flatten);
134
+ (0, core_1.expect)(rebuilt.firstName).toBeEqual('Müller');
135
+ (0, core_1.expect)(rebuilt.lastName).toBeEqual('O\'Reilly');
136
+ });
137
+ it('should build properties with empty string firstName', () => {
138
+ const flattened = {
139
+ firstName: '',
140
+ lastName: 'Empty'
141
+ };
142
+ const props = PersonPrivateProperties_1.PersonPrivateProperties.builder.build(flattened);
143
+ (0, core_1.expect)(props.firstName).toBeEqual('');
144
+ (0, core_1.expect)(props.lastName).toBeEqual('Empty');
145
+ });
146
+ it('should preserve exact values through multiple round-trips', () => {
147
+ const original = new PersonPrivateProperties_1.PersonPrivateProperties('Isabella', 'Martinez');
148
+ const rebuilt1 = PersonPrivateProperties_1.PersonPrivateProperties.builder.build(original.flatten);
149
+ const rebuilt2 = PersonPrivateProperties_1.PersonPrivateProperties.builder.build(rebuilt1.flatten);
150
+ const rebuilt3 = PersonPrivateProperties_1.PersonPrivateProperties.builder.build(rebuilt2.flatten);
151
+ (0, core_1.expect)(rebuilt3.firstName).toBeEqual(original.firstName);
152
+ (0, core_1.expect)(rebuilt3.lastName).toBeEqual(original.lastName);
153
+ });
154
+ });
155
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,208 @@
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 signInDate = 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, signInDate, notificationProperties, roles);
16
+ (0, core_1.expect)(props.userId).toBeEqual(userId);
17
+ (0, core_1.expect)(props.signInDate).toBeEqual(signInDate);
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 signInDate = typescript_common_functionality_1.UtcDate.now;
24
+ const props = new PersonSignInProperties_1.PersonSignInProperties(userId, signInDate);
25
+ (0, core_1.expect)(props.userId).toBeEqual(userId);
26
+ (0, core_1.expect)(props.signInDate).toBeEqual(signInDate);
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 signInDate = typescript_common_functionality_1.UtcDate.now;
33
+ const notificationProperties = new NotificationProperties_1.NotificationProperties();
34
+ const props = new PersonSignInProperties_1.PersonSignInProperties(userId, signInDate, 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 signInDate = 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, signInDate, 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.signInDate).not.toBeUndefined();
55
+ (0, core_1.expect)(props2.signInDate).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 signInDate = 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, signInDate, notificationProperties, roles);
65
+ const flattened = props.flatten;
66
+ (0, core_1.expect)(flattened.userId).toBeEqual('user-flat-1');
67
+ (0, core_1.expect)(flattened.signInDate).toBeEqual(signInDate.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 signInDate = typescript_common_functionality_1.UtcDate.now;
74
+ const props = new PersonSignInProperties_1.PersonSignInProperties(userId, signInDate);
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 signInDate = typescript_common_functionality_1.UtcDate.now;
83
+ const roles = ['person-manager'];
84
+ const props = new PersonSignInProperties_1.PersonSignInProperties(userId, signInDate, 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.signInDate).toBeEqual(signInDate.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 signInDate = typescript_common_functionality_1.UtcDate.now;
93
+ const props = new PersonSignInProperties_1.PersonSignInProperties(userId, signInDate);
94
+ const flattened = props.flatten;
95
+ (0, core_1.expect)(typeof flattened.userId).toBeEqual('string');
96
+ (0, core_1.expect)(typeof flattened.signInDate).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 signInDate = typescript_common_functionality_1.UtcDate.now;
103
+ const roles = ['person-manager', 'fine-manager', 'team-manager'];
104
+ const props = new PersonSignInProperties_1.PersonSignInProperties(userId, signInDate, 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
+ signInDate: 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
+ signInDate: 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
+ signInDate: 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 signInDate = typescript_common_functionality_1.UtcDate.now;
160
+ const roles = ['fine-manager', 'fine-can-add'];
161
+ const original = new PersonSignInProperties_1.PersonSignInProperties(userId, signInDate, 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.signInDate.flatten).toBeEqual(original.signInDate.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 signInDate = typescript_common_functionality_1.UtcDate.now;
171
+ const original = new PersonSignInProperties_1.PersonSignInProperties(userId, signInDate);
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 signInDate = typescript_common_functionality_1.UtcDate.now;
179
+ const notificationProperties = new NotificationProperties_1.NotificationProperties();
180
+ const original = new PersonSignInProperties_1.PersonSignInProperties(userId, signInDate, 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
+ signInDate: 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.signInDate).not.toBeUndefined();
204
+ (0, core_1.expect)(typeof props.signInDate.flatten).toBeEqual('string');
205
+ });
206
+ });
207
+ });
208
+ });
@@ -0,0 +1 @@
1
+ export {};