Skip to content

Commit 53fa728

Browse files
committed
Fix tests
1 parent 5be4bdc commit 53fa728

1 file changed

Lines changed: 9 additions & 156 deletions

File tree

test/src/tests.js

Lines changed: 9 additions & 156 deletions
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ describe('Rokt Forwarder', () => {
699699
);
700700
});
701701

702-
it.only('should handle case when userAttributes is null but userIdentities exist', async () => {
702+
it('should handle case when userAttributes is null but userIdentities exist', async () => {
703703
window.mParticle.Rokt.filters = {
704704
userAttributeFilters: [],
705705
filterUserAttributes: function () {
@@ -711,8 +711,10 @@ describe('Rokt Forwarder', () => {
711711
},
712712
getUserIdentities: function () {
713713
return {
714-
1: 'customer123',
715-
7: 'test@example.com',
714+
userIdentities: {
715+
customerid: 'customer123',
716+
email: 'test@example.com',
717+
},
716718
};
717719
},
718720
},
@@ -768,8 +770,10 @@ describe('Rokt Forwarder', () => {
768770
},
769771
getUserIdentities: function () {
770772
return {
771-
1: 'customer123',
772-
7: 'test@example.com',
773+
userIdentities: {
774+
customerid: 'customer123',
775+
email: 'test@example.com',
776+
},
773777
};
774778
},
775779
},
@@ -921,157 +925,6 @@ describe('Rokt Forwarder', () => {
921925
}
922926
);
923927
});
924-
925-
it('should handle all identity types correctly', async () => {
926-
window.mParticle.Rokt.filters = {
927-
userAttributeFilters: [],
928-
filterUserAttributes: function (attributes) {
929-
return attributes;
930-
},
931-
filteredUser: {
932-
getMPID: function () {
933-
return '123';
934-
},
935-
getUserIdentities: function () {
936-
return {
937-
0: 'other-value',
938-
1: 'customer123',
939-
2: 'fb-id',
940-
3: 'twitter-id',
941-
4: 'google-id',
942-
5: 'ms-id',
943-
6: 'yahoo-id',
944-
7: 'test@example.com',
945-
9: 'fb-audience-id',
946-
10: 'other2-value',
947-
11: 'other3-value',
948-
12: 'other4-value',
949-
13: 'other5-value',
950-
14: 'other6-value',
951-
15: 'other7-value',
952-
16: 'other8-value',
953-
17: 'other9-value',
954-
18: 'other10-value',
955-
19: '1234567890',
956-
20: 'phone2-value',
957-
21: 'phone3-value',
958-
};
959-
},
960-
},
961-
};
962-
963-
// Set up the createLauncher to properly resolve asynchronously
964-
window.Rokt.createLauncher = async function () {
965-
return Promise.resolve({
966-
selectPlacements: function (options) {
967-
window.mParticle.Rokt.selectPlacementsOptions =
968-
options;
969-
window.mParticle.Rokt.selectPlacementsCalled = true;
970-
},
971-
});
972-
};
973-
974-
await window.mParticle.forwarder.init(
975-
{
976-
accountId: '123456',
977-
},
978-
reportService.cb,
979-
true,
980-
null,
981-
{}
982-
);
983-
984-
// Wait for initialization to complete (after launcher is created)
985-
await waitForCondition(() => {
986-
return window.mParticle.forwarder.isInitialized;
987-
});
988-
989-
await window.mParticle.forwarder.selectPlacements({
990-
identifier: 'test-placement',
991-
attributes: {},
992-
});
993-
994-
window.Rokt.selectPlacementsOptions.attributes.should.deepEqual({
995-
other: 'other-value',
996-
customerid: 'customer123',
997-
facebook: 'fb-id',
998-
twitter: 'twitter-id',
999-
google: 'google-id',
1000-
microsoft: 'ms-id',
1001-
yahoo: 'yahoo-id',
1002-
email: 'test@example.com',
1003-
facebookcustomaudienceid: 'fb-audience-id',
1004-
other2: 'other2-value',
1005-
other3: 'other3-value',
1006-
other4: 'other4-value',
1007-
other5: 'other5-value',
1008-
other6: 'other6-value',
1009-
other7: 'other7-value',
1010-
other8: 'other8-value',
1011-
other9: 'other9-value',
1012-
other10: 'other10-value',
1013-
phone_number_2: 'phone2-value',
1014-
phone_number_3: 'phone3-value',
1015-
mobile_number: '1234567890',
1016-
mpid: '123',
1017-
});
1018-
});
1019-
1020-
it('should handle unknown identity types as unknown', async () => {
1021-
window.mParticle.Rokt.filters = {
1022-
userAttributeFilters: [],
1023-
filterUserAttributes: function (attributes) {
1024-
return attributes;
1025-
},
1026-
filteredUser: {
1027-
getMPID: function () {
1028-
return '123';
1029-
},
1030-
getUserIdentities: function () {
1031-
return {
1032-
999: 'unknown-type-value',
1033-
};
1034-
},
1035-
},
1036-
};
1037-
1038-
window.Rokt.createLauncher = async function () {
1039-
return Promise.resolve({
1040-
selectPlacements: function (options) {
1041-
window.mParticle.Rokt.selectPlacementsOptions =
1042-
options;
1043-
window.mParticle.Rokt.selectPlacementsCalled = true;
1044-
},
1045-
});
1046-
};
1047-
1048-
await window.mParticle.forwarder.init(
1049-
{
1050-
accountId: '123456',
1051-
},
1052-
reportService.cb,
1053-
true,
1054-
null,
1055-
{}
1056-
);
1057-
1058-
// Wait for initialization to complete (after launcher is created)
1059-
await waitForCondition(() => {
1060-
return window.mParticle.forwarder.isInitialized;
1061-
});
1062-
1063-
await window.mParticle.forwarder.selectPlacements({
1064-
identifier: 'test-placement',
1065-
attributes: {},
1066-
});
1067-
1068-
window.Rokt.selectPlacementsOptions.attributes.should.deepEqual(
1069-
{
1070-
unknown: 'unknown-type-value',
1071-
mpid: '123',
1072-
}
1073-
);
1074-
});
1075928
});
1076929
});
1077930

0 commit comments

Comments
 (0)