@stevenkellner/team-conduct-api 2.0.18 → 2.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/src/functions/fine/add.d.ts +3 -8
- package/lib/src/functions/fine/add.js +1 -2
- package/lib/src/functions/fine/delete.d.ts +1 -6
- package/lib/src/functions/fine/delete.js +2 -3
- package/lib/src/functions/fine/update.d.ts +2 -8
- package/lib/src/functions/fine/update.js +1 -3
- package/lib/src/functions/fineTemplate/add.d.ts +3 -3
- package/lib/src/functions/fineTemplate/update.d.ts +3 -3
- package/lib/src/functions/firebaseFunctionsContext.d.ts +34 -1
- package/lib/src/functions/firebaseFunctionsContext.js +33 -33
- package/lib/src/functions/index.d.ts +10 -8
- package/lib/src/functions/index.js +11 -8
- package/lib/src/functions/notification/markNotificationAsRead.d.ts +14 -0
- package/lib/src/functions/notification/{subscribe.js → markNotificationAsRead.js} +5 -7
- package/lib/src/functions/person/kickout.d.ts +6 -6
- package/lib/src/functions/person/kickout.js +4 -4
- package/lib/src/functions/person/roleEdit.d.ts +5 -5
- package/lib/src/functions/person/roleEdit.js +3 -3
- package/lib/src/functions/{paypalMe/edit.d.ts → team/delete.d.ts} +5 -7
- package/lib/src/functions/{paypalMe/edit.js → team/delete.js} +4 -5
- package/lib/src/functions/team/new.d.ts +18 -18
- package/lib/src/functions/team/new.js +8 -4
- package/lib/src/functions/team/update.d.ts +34 -0
- package/lib/src/functions/team/update.js +23 -0
- package/lib/src/functions/user/register.d.ts +4 -0
- package/lib/src/functions/user/register.js +3 -1
- package/lib/src/functions/user/update.d.ts +26 -0
- package/lib/src/functions/user/update.js +15 -0
- package/lib/src/index.d.ts +1 -1
- package/lib/src/index.js +1 -1
- package/lib/src/locales/de.d.ts +1 -1
- package/lib/src/locales/de.js +6 -2
- package/lib/src/locales/en.d.ts +6 -2
- package/lib/src/locales/en.js +6 -2
- package/lib/src/types/{MoneyAmount.d.ts → Money.d.ts} +23 -23
- package/lib/src/types/{MoneyAmount.js → Money.js} +25 -25
- package/lib/src/types/fine/Fine.d.ts +275 -0
- package/lib/src/types/fine/Fine.js +318 -0
- package/lib/src/types/fine/FineTemplate.d.ts +154 -0
- package/lib/src/types/fine/FineTemplate.js +170 -0
- package/lib/src/types/{PayedState.d.ts → fine/PayedState.d.ts} +1 -1
- package/lib/src/types/{PayedState.js → fine/PayedState.js} +1 -1
- package/lib/src/types/fine/index.d.ts +3 -0
- package/lib/src/{firebase → types/fine}/index.js +3 -6
- package/lib/src/types/index.d.ts +7 -18
- package/lib/src/types/index.js +7 -18
- package/lib/src/types/{Localization.d.ts → localization/Localization.d.ts} +15 -43
- package/lib/src/types/localization/Localization.js +54 -0
- package/lib/src/types/localization/PluralLocalization.d.ts +23 -0
- package/lib/src/types/localization/PluralLocalization.js +35 -0
- package/lib/src/types/{Pluralization.d.ts → localization/Pluralization.d.ts} +1 -0
- package/lib/src/types/{Pluralization.js → localization/Pluralization.js} +1 -0
- package/lib/src/types/localization/ValueLocalization.d.ts +22 -0
- package/lib/src/types/localization/ValueLocalization.js +41 -0
- package/lib/src/types/localization/index.d.ts +5 -0
- package/lib/src/types/localization/index.js +21 -0
- package/lib/src/types/notification/InAppNotification.d.ts +152 -0
- package/lib/src/types/notification/InAppNotification.js +136 -0
- package/lib/src/types/notification/index.d.ts +1 -0
- package/lib/src/types/notification/index.js +17 -0
- package/lib/src/types/{Person.d.ts → person/Person.d.ts} +3 -3
- package/lib/src/types/{Person.js → person/Person.js} +3 -3
- package/lib/src/types/{PersonProperties.d.ts → person/PersonProperties.d.ts} +8 -7
- package/lib/src/types/{PersonProperties.js → person/PersonProperties.js} +7 -6
- package/lib/src/types/{PersonSignInProperties.d.ts → person/PersonSignInProperties.d.ts} +9 -11
- package/lib/src/types/{PersonSignInProperties.js → person/PersonSignInProperties.js} +7 -10
- package/lib/src/types/person/index.d.ts +3 -0
- package/lib/src/types/person/index.js +19 -0
- package/lib/src/types/{Invitation.d.ts → team/Invitation.d.ts} +1 -1
- package/lib/src/types/{Invitation.js → team/Invitation.js} +1 -1
- package/lib/src/types/team/Team.d.ts +144 -0
- package/lib/src/types/team/Team.js +141 -0
- package/lib/src/types/team/TeamRole.d.ts +30 -0
- package/lib/src/types/{UserRole.js → team/TeamRole.js} +16 -15
- package/lib/src/types/team/index.d.ts +3 -0
- package/lib/src/types/team/index.js +19 -0
- package/lib/src/types/{NotificationProperties.d.ts → user/NotificationProperties.d.ts} +8 -3
- package/lib/src/types/{NotificationProperties.js → user/NotificationProperties.js} +4 -0
- package/lib/src/types/user/User.d.ts +328 -0
- package/lib/src/types/user/User.js +355 -0
- package/lib/src/types/user/index.d.ts +2 -0
- package/lib/src/types/user/index.js +18 -0
- package/lib/src/utils/StaticUnionTypeBuilder.d.ts +9 -0
- package/lib/src/utils/StaticUnionTypeBuilder.js +23 -0
- package/lib/src/utils/index.d.ts +1 -0
- package/lib/src/utils/index.js +17 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -3
- package/src/functions/fine/add.ts +3 -5
- package/src/functions/fine/delete.ts +3 -5
- package/src/functions/fine/update.ts +2 -5
- package/src/functions/firebaseFunctionsContext.ts +40 -40
- package/src/functions/index.ts +11 -9
- package/src/functions/notification/markNotificationAsRead.ts +19 -0
- package/src/functions/person/add.ts +1 -1
- package/src/functions/person/kickout.ts +6 -6
- package/src/functions/person/roleEdit.ts +5 -5
- package/src/functions/{paypalMe/edit.ts → team/delete.ts} +5 -7
- package/src/functions/team/new.ts +19 -11
- package/src/functions/team/update.ts +40 -0
- package/src/functions/user/register.ts +7 -3
- package/src/functions/user/update.ts +29 -0
- package/src/index.ts +1 -1
- package/src/locales/de.ts +7 -3
- package/src/locales/en.ts +7 -3
- package/src/types/{MoneyAmount.ts → Money.ts} +29 -29
- package/src/types/fine/Fine.ts +399 -0
- package/src/types/fine/FineTemplate.ts +219 -0
- package/src/types/{PayedState.ts → fine/PayedState.ts} +2 -2
- package/src/types/fine/index.ts +3 -0
- package/src/types/index.ts +7 -18
- package/src/types/{Localization.ts → localization/Localization.ts} +7 -64
- package/src/types/localization/PluralLocalization.ts +32 -0
- package/src/types/{Pluralization.ts → localization/Pluralization.ts} +1 -0
- package/src/types/localization/ValueLocalization.ts +36 -0
- package/src/types/localization/index.ts +5 -0
- package/src/types/notification/InAppNotification.ts +184 -0
- package/src/types/notification/index.ts +1 -0
- package/src/types/{Person.ts → person/Person.ts} +3 -3
- package/src/types/{PersonProperties.ts → person/PersonProperties.ts} +8 -7
- package/src/types/{PersonSignInProperties.ts → person/PersonSignInProperties.ts} +13 -12
- package/src/types/person/index.ts +3 -0
- package/src/types/{Invitation.ts → team/Invitation.ts} +1 -1
- package/src/types/team/Team.ts +204 -0
- package/src/types/{UserRole.ts → team/TeamRole.ts} +19 -17
- package/src/types/team/index.ts +3 -0
- package/src/types/{NotificationProperties.ts → user/NotificationProperties.ts} +12 -3
- package/src/types/user/User.ts +451 -0
- package/src/types/user/index.ts +2 -0
- package/src/utils/StaticUnionTypeBuilder.ts +23 -0
- package/src/utils/index.ts +1 -0
- package/lib/src/firebase/FirebaseConfiguration.d.ts +0 -64
- package/lib/src/firebase/FirebaseConfiguration.js +0 -79
- package/lib/src/firebase/Firestore.d.ts +0 -201
- package/lib/src/firebase/Firestore.js +0 -244
- package/lib/src/firebase/FirestoreScheme.d.ts +0 -42
- package/lib/src/firebase/FirestoreScheme.js +0 -2
- package/lib/src/firebase/Messaging.d.ts +0 -90
- package/lib/src/firebase/Messaging.js +0 -2
- package/lib/src/firebase/checkAuthentication.d.ts +0 -38
- package/lib/src/firebase/checkAuthentication.js +0 -64
- package/lib/src/firebase/index.d.ts +0 -6
- package/lib/src/firebase/pushNotification.d.ts +0 -39
- package/lib/src/firebase/pushNotification.js +0 -88
- package/lib/src/functions/notification/subscribe.d.ts +0 -18
- package/lib/src/types/Configuration.d.ts +0 -46
- package/lib/src/types/Configuration.js +0 -51
- package/lib/src/types/Fine.d.ts +0 -71
- package/lib/src/types/Fine.js +0 -74
- package/lib/src/types/FineAmount.d.ts +0 -207
- package/lib/src/types/FineAmount.js +0 -238
- package/lib/src/types/FineTemplate.d.ts +0 -69
- package/lib/src/types/FineTemplate.js +0 -72
- package/lib/src/types/FineTemplateRepetition.d.ts +0 -87
- package/lib/src/types/FineTemplateRepetition.js +0 -103
- package/lib/src/types/Localization.js +0 -115
- package/lib/src/types/Team.d.ts +0 -62
- package/lib/src/types/Team.js +0 -64
- package/lib/src/types/User.d.ts +0 -221
- package/lib/src/types/User.js +0 -235
- package/lib/src/types/UserRole.d.ts +0 -29
- package/lib/test/firebase/FirebaseConfiguration.test.d.ts +0 -1
- package/lib/test/firebase/FirebaseConfiguration.test.js +0 -158
- package/lib/test/firebase/Firestore.test.d.ts +0 -1
- package/lib/test/firebase/Firestore.test.js +0 -46
- package/lib/test/firebase/checkAuthentication.test.d.ts +0 -1
- package/lib/test/firebase/checkAuthentication.test.js +0 -356
- package/lib/test/firebase/firebase-utils.d.ts +0 -32
- package/lib/test/firebase/firebase-utils.js +0 -134
- package/lib/test/firebase/pushNotification.test.d.ts +0 -1
- package/lib/test/firebase/pushNotification.test.js +0 -300
- package/lib/test/locales/localization.de.test.d.ts +0 -1
- package/lib/test/locales/localization.de.test.js +0 -144
- package/lib/test/locales/localization.en.test.d.ts +0 -1
- package/lib/test/locales/localization.en.test.js +0 -144
- package/lib/test/types/Configuration.test.d.ts +0 -1
- package/lib/test/types/Configuration.test.js +0 -84
- package/lib/test/types/Currency.test.d.ts +0 -1
- package/lib/test/types/Currency.test.js +0 -41
- package/lib/test/types/Fine.test.d.ts +0 -1
- package/lib/test/types/Fine.test.js +0 -265
- package/lib/test/types/FineAmount.test.d.ts +0 -1
- package/lib/test/types/FineAmount.test.js +0 -445
- package/lib/test/types/FineTemplate.test.d.ts +0 -1
- package/lib/test/types/FineTemplate.test.js +0 -271
- package/lib/test/types/FineTemplateRepetition.test.d.ts +0 -1
- package/lib/test/types/FineTemplateRepetition.test.js +0 -361
- package/lib/test/types/Invitation.test.d.ts +0 -1
- package/lib/test/types/Invitation.test.js +0 -269
- package/lib/test/types/Locale.test.d.ts +0 -1
- package/lib/test/types/Locale.test.js +0 -46
- package/lib/test/types/Localization.test.d.ts +0 -1
- package/lib/test/types/Localization.test.js +0 -241
- package/lib/test/types/MoneyAmount.test.d.ts +0 -1
- package/lib/test/types/MoneyAmount.test.js +0 -276
- package/lib/test/types/NotificationProperties.test.d.ts +0 -1
- package/lib/test/types/NotificationProperties.test.js +0 -258
- package/lib/test/types/PayedState.test.d.ts +0 -1
- package/lib/test/types/PayedState.test.js +0 -136
- package/lib/test/types/Person.test.d.ts +0 -1
- package/lib/test/types/Person.test.js +0 -266
- package/lib/test/types/PersonProperties.test.d.ts +0 -1
- package/lib/test/types/PersonProperties.test.js +0 -155
- package/lib/test/types/PersonSignInProperties.test.d.ts +0 -1
- package/lib/test/types/PersonSignInProperties.test.js +0 -208
- package/lib/test/types/Pluralization.test.d.ts +0 -1
- package/lib/test/types/Pluralization.test.js +0 -206
- package/lib/test/types/Team.test.d.ts +0 -1
- package/lib/test/types/Team.test.js +0 -145
- package/lib/test/types/User.test.d.ts +0 -1
- package/lib/test/types/User.test.js +0 -450
- package/lib/test/types/UserRole.test.d.ts +0 -1
- package/lib/test/types/UserRole.test.js +0 -140
- package/src/firebase/FirebaseConfiguration.ts +0 -99
- package/src/firebase/Firestore.ts +0 -258
- package/src/firebase/FirestoreScheme.ts +0 -41
- package/src/firebase/Messaging.ts +0 -93
- package/src/firebase/checkAuthentication.ts +0 -91
- package/src/firebase/index.ts +0 -7
- package/src/firebase/pushNotification.ts +0 -90
- package/src/functions/notification/subscribe.ts +0 -23
- package/src/types/Configuration.ts +0 -65
- package/src/types/Fine.ts +0 -100
- package/src/types/FineAmount.ts +0 -303
- package/src/types/FineTemplate.ts +0 -96
- package/src/types/FineTemplateRepetition.ts +0 -125
- package/src/types/Team.ts +0 -87
- package/src/types/User.ts +0 -302
- /package/lib/src/types/{Locale.d.ts → localization/Locale.d.ts} +0 -0
- /package/lib/src/types/{Locale.js → localization/Locale.js} +0 -0
- /package/src/types/{Locale.ts → localization/Locale.ts} +0 -0
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const core_1 = require("@assertive-ts/core");
|
|
4
|
-
const PayedState_1 = require("../../src/types/PayedState");
|
|
5
|
-
describe('PayedState', () => {
|
|
6
|
-
describe('PayedState type', () => {
|
|
7
|
-
it('should be valid payed state types', () => {
|
|
8
|
-
const state1 = 'payed';
|
|
9
|
-
const state2 = 'notPayed';
|
|
10
|
-
(0, core_1.expect)(state1).toBeEqual('payed');
|
|
11
|
-
(0, core_1.expect)(state2).toBeEqual('notPayed');
|
|
12
|
-
});
|
|
13
|
-
});
|
|
14
|
-
describe('PayedState.all', () => {
|
|
15
|
-
it('should contain all payment states', () => {
|
|
16
|
-
(0, core_1.expect)(PayedState_1.PayedState.all.length).toBeEqual(2);
|
|
17
|
-
});
|
|
18
|
-
it('should contain payed', () => {
|
|
19
|
-
(0, core_1.expect)(PayedState_1.PayedState.all.includes('payed')).toBeTrue();
|
|
20
|
-
});
|
|
21
|
-
it('should contain notPayed', () => {
|
|
22
|
-
(0, core_1.expect)(PayedState_1.PayedState.all.includes('notPayed')).toBeTrue();
|
|
23
|
-
});
|
|
24
|
-
it('should contain only valid payment state strings', () => {
|
|
25
|
-
PayedState_1.PayedState.all.forEach(state => {
|
|
26
|
-
(0, core_1.expect)(typeof state).toBeEqual('string');
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
it('should be readonly', () => {
|
|
30
|
-
(0, core_1.expect)(Array.isArray(PayedState_1.PayedState.all)).toBeTrue();
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
describe('PayedState.formatted', () => {
|
|
34
|
-
describe('formatted with en locale', () => {
|
|
35
|
-
it('should format payed state', () => {
|
|
36
|
-
const formatted = PayedState_1.PayedState.formatted('payed', 'en');
|
|
37
|
-
(0, core_1.expect)(typeof formatted).toBeEqual('string');
|
|
38
|
-
(0, core_1.expect)(formatted.length).not.toBeEqual(0);
|
|
39
|
-
});
|
|
40
|
-
it('should format notPayed state', () => {
|
|
41
|
-
const formatted = PayedState_1.PayedState.formatted('notPayed', 'en');
|
|
42
|
-
(0, core_1.expect)(typeof formatted).toBeEqual('string');
|
|
43
|
-
(0, core_1.expect)(formatted.length).not.toBeEqual(0);
|
|
44
|
-
});
|
|
45
|
-
it('should return different values for different states', () => {
|
|
46
|
-
const payed = PayedState_1.PayedState.formatted('payed', 'en');
|
|
47
|
-
const notPayed = PayedState_1.PayedState.formatted('notPayed', 'en');
|
|
48
|
-
(0, core_1.expect)(payed).not.toBeEqual(notPayed);
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
describe('formatted with de locale', () => {
|
|
52
|
-
it('should format payed state', () => {
|
|
53
|
-
const formatted = PayedState_1.PayedState.formatted('payed', 'de');
|
|
54
|
-
(0, core_1.expect)(typeof formatted).toBeEqual('string');
|
|
55
|
-
(0, core_1.expect)(formatted.length).not.toBeEqual(0);
|
|
56
|
-
});
|
|
57
|
-
it('should format notPayed state', () => {
|
|
58
|
-
const formatted = PayedState_1.PayedState.formatted('notPayed', 'de');
|
|
59
|
-
(0, core_1.expect)(typeof formatted).toBeEqual('string');
|
|
60
|
-
(0, core_1.expect)(formatted.length).not.toBeEqual(0);
|
|
61
|
-
});
|
|
62
|
-
it('should return different values for different states', () => {
|
|
63
|
-
const payed = PayedState_1.PayedState.formatted('payed', 'de');
|
|
64
|
-
const notPayed = PayedState_1.PayedState.formatted('notPayed', 'de');
|
|
65
|
-
(0, core_1.expect)(payed).not.toBeEqual(notPayed);
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
describe('formatted for all states and locales', () => {
|
|
69
|
-
it('should format all states in all locales', () => {
|
|
70
|
-
PayedState_1.PayedState.all.forEach(state => {
|
|
71
|
-
const enFormatted = PayedState_1.PayedState.formatted(state, 'en');
|
|
72
|
-
const deFormatted = PayedState_1.PayedState.formatted(state, 'de');
|
|
73
|
-
(0, core_1.expect)(enFormatted.length).not.toBeEqual(0);
|
|
74
|
-
(0, core_1.expect)(deFormatted.length).not.toBeEqual(0);
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
it('should return different values for different locales', () => {
|
|
78
|
-
const enPayed = PayedState_1.PayedState.formatted('payed', 'en');
|
|
79
|
-
const dePayed = PayedState_1.PayedState.formatted('payed', 'de');
|
|
80
|
-
const enNotPayed = PayedState_1.PayedState.formatted('notPayed', 'en');
|
|
81
|
-
const deNotPayed = PayedState_1.PayedState.formatted('notPayed', 'de');
|
|
82
|
-
// At least some should differ (assuming localization exists)
|
|
83
|
-
const allFormattings = [enPayed, dePayed, enNotPayed, deNotPayed];
|
|
84
|
-
const uniqueFormattings = new Set(allFormattings);
|
|
85
|
-
(0, core_1.expect)(uniqueFormattings.size).not.toBeEqual(1);
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
describe('PayedState.toggled', () => {
|
|
90
|
-
it('should toggle payed to notPayed', () => {
|
|
91
|
-
const result = PayedState_1.PayedState.toggled('payed');
|
|
92
|
-
(0, core_1.expect)(result).toBeEqual('notPayed');
|
|
93
|
-
});
|
|
94
|
-
it('should toggle notPayed to payed', () => {
|
|
95
|
-
const result = PayedState_1.PayedState.toggled('notPayed');
|
|
96
|
-
(0, core_1.expect)(result).toBeEqual('payed');
|
|
97
|
-
});
|
|
98
|
-
it('should toggle back and forth', () => {
|
|
99
|
-
const state1 = 'payed';
|
|
100
|
-
const state2 = PayedState_1.PayedState.toggled(state1);
|
|
101
|
-
const state3 = PayedState_1.PayedState.toggled(state2);
|
|
102
|
-
(0, core_1.expect)(state2).toBeEqual('notPayed');
|
|
103
|
-
(0, core_1.expect)(state3).toBeEqual('payed');
|
|
104
|
-
});
|
|
105
|
-
it('should toggle all payment states', () => {
|
|
106
|
-
PayedState_1.PayedState.all.forEach(state => {
|
|
107
|
-
const toggled = PayedState_1.PayedState.toggled(state);
|
|
108
|
-
(0, core_1.expect)(toggled).not.toBeEqual(state);
|
|
109
|
-
(0, core_1.expect)(PayedState_1.PayedState.all.includes(toggled)).toBeTrue();
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
it('should be reversible', () => {
|
|
113
|
-
PayedState_1.PayedState.all.forEach(state => {
|
|
114
|
-
const toggledOnce = PayedState_1.PayedState.toggled(state);
|
|
115
|
-
const toggledTwice = PayedState_1.PayedState.toggled(toggledOnce);
|
|
116
|
-
(0, core_1.expect)(toggledTwice).toBeEqual(state);
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
describe('PayedState.builder', () => {
|
|
121
|
-
it('should build valid payment state from string', () => {
|
|
122
|
-
const state = PayedState_1.PayedState.builder.build('payed');
|
|
123
|
-
(0, core_1.expect)(state).toBeEqual('payed');
|
|
124
|
-
});
|
|
125
|
-
it('should preserve payment state value', () => {
|
|
126
|
-
const state = PayedState_1.PayedState.builder.build('notPayed');
|
|
127
|
-
(0, core_1.expect)(state).toBeEqual('notPayed');
|
|
128
|
-
});
|
|
129
|
-
it('should build all payment states', () => {
|
|
130
|
-
PayedState_1.PayedState.all.forEach(state => {
|
|
131
|
-
const built = PayedState_1.PayedState.builder.build(state);
|
|
132
|
-
(0, core_1.expect)(built).toBeEqual(state);
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,266 +0,0 @@
|
|
|
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 PersonProperties_1 = require("../../src/types/PersonProperties");
|
|
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 PersonProperties_1.PersonProperties('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 PersonProperties_1.PersonProperties('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 PersonProperties_1.PersonProperties('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 PersonProperties_1.PersonProperties('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 PersonProperties_1.PersonProperties('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 PersonProperties_1.PersonProperties('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 PersonProperties_1.PersonProperties('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 PersonProperties_1.PersonProperties('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 PersonProperties_1.PersonProperties('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 PersonProperties_1.PersonProperties('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 PersonProperties_1.PersonProperties('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 PersonProperties_1.PersonProperties('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 PersonProperties_1.PersonProperties('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 PersonProperties_1.PersonProperties('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
|
-
joinDate: 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 PersonProperties_1.PersonProperties('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 PersonProperties_1.PersonProperties('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 PersonProperties_1.PersonProperties('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 PersonProperties_1.PersonProperties('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
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const core_1 = require("@assertive-ts/core");
|
|
4
|
-
const PersonProperties_1 = require("../../src/types/PersonProperties");
|
|
5
|
-
describe('PersonProperties', () => {
|
|
6
|
-
describe('PersonProperties constructor', () => {
|
|
7
|
-
it('should create properties with first name and last name', () => {
|
|
8
|
-
const props = new PersonProperties_1.PersonProperties('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 PersonProperties_1.PersonProperties('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 PersonProperties_1.PersonProperties(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 PersonProperties_1.PersonProperties('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 PersonProperties_1.PersonProperties(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 PersonProperties_1.PersonProperties('', 'Doe');
|
|
44
|
-
(0, core_1.expect)(props.firstName).toBeEqual('');
|
|
45
|
-
(0, core_1.expect)(props.lastName).toBeEqual('Doe');
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
describe('PersonProperties.flatten', () => {
|
|
49
|
-
it('should return flattened representation with both names', () => {
|
|
50
|
-
const props = new PersonProperties_1.PersonProperties('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 PersonProperties_1.PersonProperties('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 PersonProperties_1.PersonProperties(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 PersonProperties_1.PersonProperties('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 PersonProperties_1.PersonProperties('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 PersonProperties_1.PersonProperties('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('PersonProperties.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 = PersonProperties_1.PersonProperties.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 = PersonProperties_1.PersonProperties.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 PersonProperties_1.PersonProperties('Sophia', 'Wilson');
|
|
108
|
-
const rebuilt = PersonProperties_1.PersonProperties.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 PersonProperties_1.PersonProperties('Liam', null);
|
|
114
|
-
const rebuilt = PersonProperties_1.PersonProperties.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 = PersonProperties_1.PersonProperties.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 PersonProperties_1.PersonProperties('Müller', 'O\'Reilly');
|
|
133
|
-
const rebuilt = PersonProperties_1.PersonProperties.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 = PersonProperties_1.PersonProperties.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 PersonProperties_1.PersonProperties('Isabella', 'Martinez');
|
|
148
|
-
const rebuilt1 = PersonProperties_1.PersonProperties.builder.build(original.flatten);
|
|
149
|
-
const rebuilt2 = PersonProperties_1.PersonProperties.builder.build(rebuilt1.flatten);
|
|
150
|
-
const rebuilt3 = PersonProperties_1.PersonProperties.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
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|