@wipperoz/common-entities-account 1.0.1 → 1.0.2
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.
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AccountSettings = void 0;
|
|
4
|
+
class AccountSettings {
|
|
5
|
+
constructor(data) {
|
|
6
|
+
if (data) {
|
|
7
|
+
this.Items = data.Items;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.AccountSettings = AccountSettings;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const account_settings_model_1 = require("./account-settings.model");
|
|
4
|
+
const enums_1 = require("../enums");
|
|
5
|
+
describe('AccountSettings Model', () => {
|
|
6
|
+
it('should create an AccountSettings instance with data', () => {
|
|
7
|
+
const data = {
|
|
8
|
+
Items: [
|
|
9
|
+
{
|
|
10
|
+
Pkey: 'user-id:123',
|
|
11
|
+
Skey: 'account-settings-id:456',
|
|
12
|
+
Details: {
|
|
13
|
+
wipperozNotifications: [
|
|
14
|
+
{
|
|
15
|
+
notificationType: enums_1.NotificationTypeEnum.BILLING,
|
|
16
|
+
allowChange: true,
|
|
17
|
+
notificationActive: true,
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
};
|
|
24
|
+
const accountSettings = new account_settings_model_1.AccountSettings(data);
|
|
25
|
+
expect(accountSettings.Items).toEqual(data.Items);
|
|
26
|
+
});
|
|
27
|
+
it('should create an AccountSettings instance without data', () => {
|
|
28
|
+
const accountSettings = new account_settings_model_1.AccountSettings();
|
|
29
|
+
expect(accountSettings.Items).toBeUndefined();
|
|
30
|
+
});
|
|
31
|
+
it('should handle undefined Items property', () => {
|
|
32
|
+
const data = {};
|
|
33
|
+
const accountSettings = new account_settings_model_1.AccountSettings(data);
|
|
34
|
+
expect(accountSettings.Items).toBeUndefined();
|
|
35
|
+
});
|
|
36
|
+
it('should handle empty Items array', () => {
|
|
37
|
+
const data = {
|
|
38
|
+
Items: [],
|
|
39
|
+
};
|
|
40
|
+
const accountSettings = new account_settings_model_1.AccountSettings(data);
|
|
41
|
+
expect(accountSettings.Items).toEqual([]);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WipperozNotification = void 0;
|
|
4
|
+
class WipperozNotification {
|
|
5
|
+
constructor(data) {
|
|
6
|
+
this.notificationType = data.notificationType;
|
|
7
|
+
this.allowChange = data.allowChange;
|
|
8
|
+
this.notificationActive = data.notificationActive;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.WipperozNotification = WipperozNotification;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const wipperoz_notification_model_1 = require("./wipperoz-notification.model");
|
|
4
|
+
const notificationType_enum_1 = require("../enums/notificationType.enum");
|
|
5
|
+
describe('WipperozNotification Model', () => {
|
|
6
|
+
it('should create a WipperozNotification instance with data', () => {
|
|
7
|
+
const data = {
|
|
8
|
+
notificationType: notificationType_enum_1.NotificationTypeEnum.BILLING,
|
|
9
|
+
allowChange: true,
|
|
10
|
+
notificationActive: true,
|
|
11
|
+
};
|
|
12
|
+
const notification = new wipperoz_notification_model_1.WipperozNotification(data);
|
|
13
|
+
expect(notification.notificationType).toBe(notificationType_enum_1.NotificationTypeEnum.BILLING);
|
|
14
|
+
expect(notification.allowChange).toBe(true);
|
|
15
|
+
expect(notification.notificationActive).toBe(true);
|
|
16
|
+
});
|
|
17
|
+
it('should allow changing notificationActive property', () => {
|
|
18
|
+
const data = {
|
|
19
|
+
notificationType: notificationType_enum_1.NotificationTypeEnum.MARKETING,
|
|
20
|
+
allowChange: true,
|
|
21
|
+
notificationActive: false,
|
|
22
|
+
};
|
|
23
|
+
const notification = new wipperoz_notification_model_1.WipperozNotification(data);
|
|
24
|
+
notification.notificationActive = true;
|
|
25
|
+
expect(notification.notificationActive).toBe(true);
|
|
26
|
+
});
|
|
27
|
+
it('should handle allowChange property correctly', () => {
|
|
28
|
+
const data = {
|
|
29
|
+
notificationType: notificationType_enum_1.NotificationTypeEnum.BILLING,
|
|
30
|
+
allowChange: false,
|
|
31
|
+
notificationActive: true,
|
|
32
|
+
};
|
|
33
|
+
const notification = new wipperoz_notification_model_1.WipperozNotification(data);
|
|
34
|
+
expect(notification.allowChange).toBe(false);
|
|
35
|
+
});
|
|
36
|
+
it('should handle notificationType property correctly', () => {
|
|
37
|
+
const data = {
|
|
38
|
+
notificationType: notificationType_enum_1.NotificationTypeEnum.MARKETING,
|
|
39
|
+
allowChange: true,
|
|
40
|
+
notificationActive: false,
|
|
41
|
+
};
|
|
42
|
+
const notification = new wipperoz_notification_model_1.WipperozNotification(data);
|
|
43
|
+
expect(notification.notificationType).toBe(notificationType_enum_1.NotificationTypeEnum.MARKETING);
|
|
44
|
+
});
|
|
45
|
+
});
|