@tellescope/sdk 1.2.4 → 1.3.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.
- package/lib/cjs/enduser.d.ts +7 -3
- package/lib/cjs/enduser.d.ts.map +1 -1
- package/lib/cjs/enduser.js +18 -7
- package/lib/cjs/enduser.js.map +1 -1
- package/lib/cjs/sdk.d.ts +5 -2
- package/lib/cjs/sdk.d.ts.map +1 -1
- package/lib/cjs/sdk.js +4 -0
- package/lib/cjs/sdk.js.map +1 -1
- package/lib/cjs/session.d.ts +0 -1
- package/lib/cjs/session.d.ts.map +1 -1
- package/lib/cjs/tests/tests.d.ts +1 -0
- package/lib/cjs/tests/tests.d.ts.map +1 -1
- package/lib/cjs/tests/tests.js +168 -64
- package/lib/cjs/tests/tests.js.map +1 -1
- package/lib/esm/enduser.d.ts +7 -2
- package/lib/esm/enduser.d.ts.map +1 -1
- package/lib/esm/enduser.js +18 -7
- package/lib/esm/enduser.js.map +1 -1
- package/lib/esm/sdk.d.ts +5 -1
- package/lib/esm/sdk.d.ts.map +1 -1
- package/lib/esm/sdk.js +4 -0
- package/lib/esm/sdk.js.map +1 -1
- package/lib/esm/tests/tests.d.ts +1 -0
- package/lib/esm/tests/tests.d.ts.map +1 -1
- package/lib/esm/tests/tests.js +166 -63
- package/lib/esm/tests/tests.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/src/enduser.ts +36 -9
- package/src/sdk.ts +20 -2
- package/src/tests/tests.ts +71 -35
package/lib/esm/tests/tests.js
CHANGED
|
@@ -554,6 +554,7 @@ var run_generated_tests = function (_a) {
|
|
|
554
554
|
if (!(d === null || d === void 0 ? void 0 : d.id))
|
|
555
555
|
return false;
|
|
556
556
|
for (var k in instance) {
|
|
557
|
+
// @ts-ignore
|
|
557
558
|
if (!objects_equivalent(instance[k], d[k]))
|
|
558
559
|
return false;
|
|
559
560
|
}
|
|
@@ -568,6 +569,7 @@ var run_generated_tests = function (_a) {
|
|
|
568
569
|
if (!(d === null || d === void 0 ? void 0 : d.id))
|
|
569
570
|
return false;
|
|
570
571
|
for (var k in instance) {
|
|
572
|
+
// @ts-ignore
|
|
571
573
|
if (!objects_equivalent(instance[k], d[k]))
|
|
572
574
|
return false;
|
|
573
575
|
}
|
|
@@ -894,33 +896,56 @@ var email_tests = function (queries) {
|
|
|
894
896
|
textContent: "This is at est email"
|
|
895
897
|
};
|
|
896
898
|
return [4 /*yield*/, async_test("send-email - missing email", function () { return queries.createOne(__assign(__assign({}, testEmail), { enduserId: meNoEmail.id, logOnly: false })); }, // constraint ignored when logOnly is true
|
|
897
|
-
{ shouldError: true, onError: function (e) { return e.message === "Missing email"; } })
|
|
899
|
+
{ shouldError: true, onError: function (e) { return e.message === "Missing email"; } })
|
|
900
|
+
// await async_test(
|
|
901
|
+
// `send-email - missing consent`,
|
|
902
|
+
// () => queries.createOne({ ...testEmail, enduserId: meNoConsent.id, logOnly: false }), // constraint ignored when logOnly is true
|
|
903
|
+
// { shouldError: true, onError: e => e.message === "Missing email consent" }
|
|
904
|
+
// )
|
|
905
|
+
// await async_test(
|
|
906
|
+
// `send-email - missing consent (multiple)`,
|
|
907
|
+
// () => queries.createSome([{ ...testEmail, enduserId: meNoConsent.id, logOnly: false }, { ...testEmail, enduserId: meNoConsent.id, logOnly: false }]), // constraint ignored when logOnly is true
|
|
908
|
+
// { shouldError: true, onError: e => e.message === "Missing email consent" }
|
|
909
|
+
// )
|
|
910
|
+
];
|
|
898
911
|
case 4:
|
|
899
912
|
_a.sent();
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
913
|
+
// await async_test(
|
|
914
|
+
// `send-email - missing consent`,
|
|
915
|
+
// () => queries.createOne({ ...testEmail, enduserId: meNoConsent.id, logOnly: false }), // constraint ignored when logOnly is true
|
|
916
|
+
// { shouldError: true, onError: e => e.message === "Missing email consent" }
|
|
917
|
+
// )
|
|
918
|
+
// await async_test(
|
|
919
|
+
// `send-email - missing consent (multiple)`,
|
|
920
|
+
// () => queries.createSome([{ ...testEmail, enduserId: meNoConsent.id, logOnly: false }, { ...testEmail, enduserId: meNoConsent.id, logOnly: false }]), // constraint ignored when logOnly is true
|
|
921
|
+
// { shouldError: true, onError: e => e.message === "Missing email consent" }
|
|
922
|
+
// )
|
|
908
923
|
return [4 /*yield*/, async_test("send-email", function () { return queries.createOne(testEmail); }, { onResult: function (t) { return !!t; } })];
|
|
909
|
-
case
|
|
924
|
+
case 5:
|
|
925
|
+
// await async_test(
|
|
926
|
+
// `send-email - missing consent`,
|
|
927
|
+
// () => queries.createOne({ ...testEmail, enduserId: meNoConsent.id, logOnly: false }), // constraint ignored when logOnly is true
|
|
928
|
+
// { shouldError: true, onError: e => e.message === "Missing email consent" }
|
|
929
|
+
// )
|
|
930
|
+
// await async_test(
|
|
931
|
+
// `send-email - missing consent (multiple)`,
|
|
932
|
+
// () => queries.createSome([{ ...testEmail, enduserId: meNoConsent.id, logOnly: false }, { ...testEmail, enduserId: meNoConsent.id, logOnly: false }]), // constraint ignored when logOnly is true
|
|
933
|
+
// { shouldError: true, onError: e => e.message === "Missing email consent" }
|
|
934
|
+
// )
|
|
910
935
|
_a.sent();
|
|
911
936
|
testEmail.subject = "Test Email (Multi-Send)";
|
|
912
937
|
testEmail.textContent = "Multiple content";
|
|
913
938
|
return [4 /*yield*/, async_test("send-email (multiple)", function () { return queries.createSome([testEmail, testEmail, testEmail]); }, { onResult: function (t) { return !!t; } })];
|
|
914
|
-
case
|
|
939
|
+
case 6:
|
|
915
940
|
_a.sent();
|
|
916
941
|
return [4 /*yield*/, sdk.api.endusers.deleteOne(me.id)];
|
|
917
|
-
case
|
|
942
|
+
case 7:
|
|
918
943
|
_a.sent();
|
|
919
944
|
return [4 /*yield*/, sdk.api.endusers.deleteOne(meNoEmail.id)];
|
|
920
|
-
case
|
|
945
|
+
case 8:
|
|
921
946
|
_a.sent();
|
|
922
947
|
return [4 /*yield*/, sdk.api.endusers.deleteOne(meNoConsent.id)];
|
|
923
|
-
case
|
|
948
|
+
case 9:
|
|
924
949
|
_a.sent();
|
|
925
950
|
return [2 /*return*/];
|
|
926
951
|
}
|
|
@@ -948,31 +973,55 @@ var sms_tests = function (queries) {
|
|
|
948
973
|
message: "Test SMS",
|
|
949
974
|
};
|
|
950
975
|
return [4 /*yield*/, async_test("send-sms - missing phone", function () { return queries.createOne(__assign(__assign({}, testSMS), { enduserId: meNoPhone.id, logOnly: false })); }, // constraint ignored when logOnly is true
|
|
951
|
-
{ shouldError: true, onError: function (e) { return e.message === "Missing phone"; } })
|
|
976
|
+
{ shouldError: true, onError: function (e) { return e.message === "Missing phone"; } })
|
|
977
|
+
// await async_test(
|
|
978
|
+
// `send-sms - missing phone consent`,
|
|
979
|
+
// () => queries.createOne({ ...testSMS, enduserId: meNoConsent.id, logOnly: false }), // constraint ignored when logOnly is true
|
|
980
|
+
// { shouldError: true, onError: e => e.message === "Missing phone consent" }
|
|
981
|
+
// )
|
|
982
|
+
// await async_test(
|
|
983
|
+
// `send-sms - missing phone (multiple)`,
|
|
984
|
+
// () => queries.createSome([{ ...testSMS, enduserId: meNoPhone.id, logOnly: false }, { ...testSMS, enduserId: meNoPhone.id, logOnly: false }]),
|
|
985
|
+
// { shouldError: true, onError: e => e.message === "Missing phone" }
|
|
986
|
+
// )
|
|
987
|
+
];
|
|
952
988
|
case 4:
|
|
953
989
|
_a.sent();
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
990
|
+
// await async_test(
|
|
991
|
+
// `send-sms - missing phone consent`,
|
|
992
|
+
// () => queries.createOne({ ...testSMS, enduserId: meNoConsent.id, logOnly: false }), // constraint ignored when logOnly is true
|
|
993
|
+
// { shouldError: true, onError: e => e.message === "Missing phone consent" }
|
|
994
|
+
// )
|
|
995
|
+
// await async_test(
|
|
996
|
+
// `send-sms - missing phone (multiple)`,
|
|
997
|
+
// () => queries.createSome([{ ...testSMS, enduserId: meNoPhone.id, logOnly: false }, { ...testSMS, enduserId: meNoPhone.id, logOnly: false }]),
|
|
998
|
+
// { shouldError: true, onError: e => e.message === "Missing phone" }
|
|
999
|
+
// )
|
|
961
1000
|
return [4 /*yield*/, async_test("send-sms", function () { return queries.createOne(testSMS); }, { onResult: function (t) { return !!t; } })];
|
|
962
|
-
case
|
|
1001
|
+
case 5:
|
|
1002
|
+
// await async_test(
|
|
1003
|
+
// `send-sms - missing phone consent`,
|
|
1004
|
+
// () => queries.createOne({ ...testSMS, enduserId: meNoConsent.id, logOnly: false }), // constraint ignored when logOnly is true
|
|
1005
|
+
// { shouldError: true, onError: e => e.message === "Missing phone consent" }
|
|
1006
|
+
// )
|
|
1007
|
+
// await async_test(
|
|
1008
|
+
// `send-sms - missing phone (multiple)`,
|
|
1009
|
+
// () => queries.createSome([{ ...testSMS, enduserId: meNoPhone.id, logOnly: false }, { ...testSMS, enduserId: meNoPhone.id, logOnly: false }]),
|
|
1010
|
+
// { shouldError: true, onError: e => e.message === "Missing phone" }
|
|
1011
|
+
// )
|
|
963
1012
|
_a.sent();
|
|
964
1013
|
testSMS.message = "(Multi-Send)";
|
|
965
1014
|
return [4 /*yield*/, async_test("send-sms (multiple)", function () { return queries.createSome([testSMS, testSMS, testSMS]); }, { onResult: function (t) { return !!t; } })];
|
|
966
|
-
case
|
|
1015
|
+
case 6:
|
|
967
1016
|
_a.sent();
|
|
968
1017
|
return [4 /*yield*/, sdk.api.endusers.deleteOne(me.id)];
|
|
969
|
-
case
|
|
1018
|
+
case 7:
|
|
970
1019
|
_a.sent();
|
|
971
1020
|
return [4 /*yield*/, sdk.api.endusers.deleteOne(meNoPhone.id)];
|
|
972
|
-
case
|
|
1021
|
+
case 8:
|
|
973
1022
|
_a.sent();
|
|
974
1023
|
return [4 /*yield*/, sdk.api.endusers.deleteOne(meNoConsent.id)];
|
|
975
|
-
case
|
|
1024
|
+
case 9:
|
|
976
1025
|
_a.sent();
|
|
977
1026
|
return [2 /*return*/];
|
|
978
1027
|
}
|
|
@@ -1009,24 +1058,37 @@ var chat_room_tests = function () { return __awaiter(void 0, void 0, void 0, fun
|
|
|
1009
1058
|
case 6:
|
|
1010
1059
|
room = _j.sent();
|
|
1011
1060
|
assert(room.numMessages === 0, 'num mesages no update', 'num messages on creation');
|
|
1012
|
-
return [4 /*yield*/, async_test("get-chat-room (not a user)", function () { return sdk2.api.chat_rooms.getOne(room.id); }, { shouldError: true, onError: function (e) { return e.message === "Could not find a record for the given id"; } })
|
|
1061
|
+
return [4 /*yield*/, async_test("get-chat-room (not a user)", function () { return sdk2.api.chat_rooms.getOne(room.id); }, { shouldError: true, onError: function (e) { return e.message === "Could not find a record for the given id"; } })
|
|
1062
|
+
// await async_test(
|
|
1063
|
+
// `user_display_info for room (not a user)`,
|
|
1064
|
+
// () => sdk2.api.chat_rooms.display_info({ id: room.id }),
|
|
1065
|
+
// { shouldError: true, onError: e => e.message === "Could not find a record for the given id" }
|
|
1066
|
+
// )
|
|
1067
|
+
];
|
|
1013
1068
|
case 7:
|
|
1014
1069
|
_j.sent();
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1070
|
+
// await async_test(
|
|
1071
|
+
// `user_display_info for room (not a user)`,
|
|
1072
|
+
// () => sdk2.api.chat_rooms.display_info({ id: room.id }),
|
|
1073
|
+
// { shouldError: true, onError: e => e.message === "Could not find a record for the given id" }
|
|
1074
|
+
// )
|
|
1018
1075
|
return [4 /*yield*/, sdk.api.chats.createOne({ roomId: room.id, message: 'test message', attachments: [{ type: 'file', secureName: 'testsecurename' }] })];
|
|
1019
|
-
case
|
|
1076
|
+
case 8:
|
|
1077
|
+
// await async_test(
|
|
1078
|
+
// `user_display_info for room (not a user)`,
|
|
1079
|
+
// () => sdk2.api.chat_rooms.display_info({ id: room.id }),
|
|
1080
|
+
// { shouldError: true, onError: e => e.message === "Could not find a record for the given id" }
|
|
1081
|
+
// )
|
|
1020
1082
|
_j.sent();
|
|
1021
1083
|
return [4 /*yield*/, sdk.api.chat_rooms.getOne(room.id)];
|
|
1022
|
-
case
|
|
1084
|
+
case 9:
|
|
1023
1085
|
roomWithMessage = _j.sent();
|
|
1024
1086
|
assert(roomWithMessage.numMessages === 1, 'num mesages no update', 'num messages on send message');
|
|
1025
1087
|
assert(((_b = roomWithMessage === null || roomWithMessage === void 0 ? void 0 : roomWithMessage.recentMessageSentAt) !== null && _b !== void 0 ? _b : 0) > Date.now() - 1000, 'recent message timestamp bad', 'recent message timestamp');
|
|
1026
1088
|
assert(((_d = (_c = roomWithMessage === null || roomWithMessage === void 0 ? void 0 : roomWithMessage.infoForUser) === null || _c === void 0 ? void 0 : _c[userId]) === null || _d === void 0 ? void 0 : _d.unreadCount) === undefined, 'bad unread count for user', 'unread count for user');
|
|
1027
1089
|
assert(((_f = (_e = roomWithMessage === null || roomWithMessage === void 0 ? void 0 : roomWithMessage.infoForUser) === null || _e === void 0 ? void 0 : _e[enduserSDK.userInfo.id]) === null || _f === void 0 ? void 0 : _f.unreadCount) === 1, 'bad unread count for enduser', 'unread count for enduser');
|
|
1028
1090
|
return [4 /*yield*/, sdk.api.chat_rooms.updateOne(roomWithMessage.id, { infoForUser: (_a = {}, _a[userId] = { unreadCount: 0 }, _a) })];
|
|
1029
|
-
case
|
|
1091
|
+
case 10:
|
|
1030
1092
|
roomWithMessage = _j.sent();
|
|
1031
1093
|
assert(((_h = (_g = roomWithMessage === null || roomWithMessage === void 0 ? void 0 : roomWithMessage.infoForUser) === null || _g === void 0 ? void 0 : _g[userId]) === null || _h === void 0 ? void 0 : _h.unreadCount) === 0, 'bad reset unread count for user', 'reset unread count for user');
|
|
1032
1094
|
verifyRoomDisplayInfo = function (info) {
|
|
@@ -1060,44 +1122,44 @@ var chat_room_tests = function () { return __awaiter(void 0, void 0, void 0, fun
|
|
|
1060
1122
|
return true;
|
|
1061
1123
|
};
|
|
1062
1124
|
return [4 /*yield*/, async_test("user_display_info for room (for user)", function () { return sdk.api.chat_rooms.display_info({ id: room.id }); }, { onResult: function (r) { return r.id === room.id && verifyRoomDisplayInfo(r.display_info); } })];
|
|
1063
|
-
case
|
|
1125
|
+
case 11:
|
|
1064
1126
|
_j.sent();
|
|
1065
1127
|
return [4 /*yield*/, async_test("user_display_info for room (for enduser)", function () { return enduserSDK.api.chat_rooms.display_info({ id: room.id }); }, { onResult: function (r) { return r.id === room.id && verifyRoomDisplayInfo(r.display_info); } })];
|
|
1066
|
-
case
|
|
1128
|
+
case 12:
|
|
1067
1129
|
_j.sent();
|
|
1068
1130
|
return [4 /*yield*/, sdk.api.chat_rooms.deleteOne(room.id)];
|
|
1069
|
-
case
|
|
1131
|
+
case 13:
|
|
1070
1132
|
_j.sent();
|
|
1071
1133
|
return [4 /*yield*/, sdk.api.chat_rooms.createOne({})];
|
|
1072
|
-
case
|
|
1134
|
+
case 14:
|
|
1073
1135
|
emptyRoom = _j.sent();
|
|
1074
1136
|
return [4 /*yield*/, async_test("get-chat-room (creator can access, even when not in userIds)", function () { return sdk.api.chat_rooms.getOne(emptyRoom.id); }, { onResult: function (r) { return r.id === emptyRoom.id; } })];
|
|
1075
|
-
case
|
|
1137
|
+
case 15:
|
|
1076
1138
|
_j.sent();
|
|
1077
1139
|
return [4 /*yield*/, async_test("get-chat-room (not in empty room)", function () { return sdk2.api.chat_rooms.getOne(emptyRoom.id); }, { shouldError: true, onError: function (e) { return e.message === "Could not find a record for the given id"; } })];
|
|
1078
|
-
case
|
|
1140
|
+
case 16:
|
|
1079
1141
|
_j.sent();
|
|
1080
1142
|
return [4 /*yield*/, async_test("join-room", function () { return sdk2.api.chat_rooms.join_room({ id: emptyRoom.id }); }, { onResult: function (_a) {
|
|
1081
1143
|
var room = _a.room;
|
|
1082
1144
|
return room.id === emptyRoom.id;
|
|
1083
1145
|
} })];
|
|
1084
|
-
case
|
|
1146
|
+
case 17:
|
|
1085
1147
|
_j.sent();
|
|
1086
1148
|
return [4 /*yield*/, async_test("get-chat-room (join successful)", function () { return sdk2.api.chat_rooms.getOne(emptyRoom.id); }, { onResult: function (r) { return r.id === emptyRoom.id; } })];
|
|
1087
|
-
case
|
|
1149
|
+
case 18:
|
|
1088
1150
|
_j.sent();
|
|
1089
1151
|
return [4 /*yield*/, enduserSDK.logout()];
|
|
1090
|
-
case
|
|
1152
|
+
case 19:
|
|
1091
1153
|
_j.sent();
|
|
1092
1154
|
return [4 /*yield*/, sdk.api.endusers.getOne(enduser.id)];
|
|
1093
|
-
case
|
|
1155
|
+
case 20:
|
|
1094
1156
|
loggedOutEnduser = _j.sent();
|
|
1095
1157
|
assert(new Date(loggedOutEnduser.lastLogout).getTime() > Date.now() - 100, 'lastLogout fail for enduser', 'lastLogout for enduser');
|
|
1096
1158
|
return [4 /*yield*/, sdk.api.endusers.deleteOne(enduser.id)];
|
|
1097
|
-
case
|
|
1159
|
+
case 21:
|
|
1098
1160
|
_j.sent();
|
|
1099
1161
|
return [4 /*yield*/, sdk.api.chat_rooms.deleteOne(emptyRoom.id)];
|
|
1100
|
-
case
|
|
1162
|
+
case 22:
|
|
1101
1163
|
_j.sent();
|
|
1102
1164
|
return [2 /*return*/];
|
|
1103
1165
|
}
|
|
@@ -1184,7 +1246,7 @@ var chat_tests = function () { return __awaiter(void 0, void 0, void 0, function
|
|
|
1184
1246
|
// () => sdk2.api.chats.updateOne(chat.id, { message: 'Hi' }),
|
|
1185
1247
|
// { shouldError: true, onError: e => e.message === 'You do not have permission to access this resource' }
|
|
1186
1248
|
// )
|
|
1187
|
-
return [4 /*yield*/, async_test("delete-chat not allowed", function () { return sdk2.api.chats.deleteOne(chat.id); },
|
|
1249
|
+
return [4 /*yield*/, async_test("delete-chat not allowed", function () { return sdk2.api.chats.deleteOne(chat.id); }, handleAnyError)
|
|
1188
1250
|
// currently disabled endpoint altogether
|
|
1189
1251
|
// await async_test(
|
|
1190
1252
|
// `update-chat can't update roomId`,
|
|
@@ -1375,7 +1437,7 @@ var enduserAccessTests = function () { return __awaiter(void 0, void 0, void 0,
|
|
|
1375
1437
|
case 11: return [4 /*yield*/, async_test("enduser can update self", function () { return enduserSDK.api.endusers.updateOne(enduser.id, { fname: "Sebastian", lname: "Coates" }); }, { onResult: function (e) { return e.id === enduser.id && e.fname === 'Sebastian' && e.lname === "Coates"; } })];
|
|
1376
1438
|
case 12:
|
|
1377
1439
|
_j.sent();
|
|
1378
|
-
return [4 /*yield*/, async_test("enduser can't update other enduser", function () { return enduserSDK.api.endusers.updateOne(enduser2.id, { fname: "Shouldn't Work" }); }, { shouldError: true, onError: function (e) { return e.message === "
|
|
1440
|
+
return [4 /*yield*/, async_test("enduser can't update other enduser", function () { return enduserSDK.api.endusers.updateOne(enduser2.id, { fname: "Shouldn't Work" }); }, { shouldError: true, onError: function (e) { return e.message === "Endusers may only update their own profile"; } })];
|
|
1379
1441
|
case 13:
|
|
1380
1442
|
_j.sent();
|
|
1381
1443
|
return [4 /*yield*/, sdk.api.tickets.createOne({ enduserId: enduser.id, title: "Accessible ticket" })];
|
|
@@ -2464,16 +2526,16 @@ var community_tests = function () { return __awaiter(void 0, void 0, void 0, fun
|
|
|
2464
2526
|
return [4 /*yield*/, async_test("enduser access privateForum error", function () { return enduserSDK.api.forums.getOne(privateForum.id); }, handleAnyError)];
|
|
2465
2527
|
case 7:
|
|
2466
2528
|
_d.sent();
|
|
2467
|
-
return [4 /*yield*/, enduserSDK.api.forum_posts.createOne({ forumId: forum.id, htmlContent: 'enduser', textContent: 'enduser' })];
|
|
2529
|
+
return [4 /*yield*/, enduserSDK.api.forum_posts.createOne({ title: 'title', forumId: forum.id, htmlContent: 'enduser', textContent: 'enduser' })];
|
|
2468
2530
|
case 8:
|
|
2469
2531
|
enduserPost = _d.sent();
|
|
2470
2532
|
assert(!!enduserPost, 'enduser post failed', 'enduser post successful');
|
|
2471
|
-
return [4 /*yield*/, sdk.api.forum_posts.createOne({ forumId: forum.id, htmlContent: 'user', textContent: 'user' })];
|
|
2533
|
+
return [4 /*yield*/, sdk.api.forum_posts.createOne({ title: 'title', forumId: forum.id, htmlContent: 'user', textContent: 'user' })];
|
|
2472
2534
|
case 9:
|
|
2473
2535
|
userPost = _d.sent();
|
|
2474
2536
|
assert(!!userPost, 'user post failed', 'user post successful');
|
|
2475
2537
|
assert(enduserPost.numComments === 0 && enduserPost.numLikes === 0, 'counts not initialized', 'counts initialized at 0');
|
|
2476
|
-
return [4 /*yield*/, async_test("enduser post private\u00A0errors", function () { return enduserSDK.api.forum_posts.createOne({ forumId: privateForum.id, htmlContent: 'enduser', textContent: 'enduser' }); }, handleAnyError)];
|
|
2538
|
+
return [4 /*yield*/, async_test("enduser post private\u00A0errors", function () { return enduserSDK.api.forum_posts.createOne({ title: 'title', forumId: privateForum.id, htmlContent: 'enduser', textContent: 'enduser' }); }, handleAnyError)];
|
|
2477
2539
|
case 10:
|
|
2478
2540
|
_d.sent();
|
|
2479
2541
|
return [4 /*yield*/, async_test("enduser can access single post for forumId", function () { return enduserSDK.api.forum_posts.getOne({ forumId: forum.id }); }, passOnAnyResult)];
|
|
@@ -2520,7 +2582,7 @@ var community_tests = function () { return __awaiter(void 0, void 0, void 0, fun
|
|
|
2520
2582
|
return [4 /*yield*/, async_test("post and like counts after unlike", function () { return sdk.api.forum_posts.getOne(enduserPost.id); }, { onResult: function (p) { return p.numComments === 2 && p.numLikes === 0; } })];
|
|
2521
2583
|
case 24:
|
|
2522
2584
|
_d.sent();
|
|
2523
|
-
return [4 /*yield*/, sdk.api.forum_posts.createOne({ forumId: privateForum.id, htmlContent: 'user', textContent: 'user' })];
|
|
2585
|
+
return [4 /*yield*/, sdk.api.forum_posts.createOne({ title: 'title', forumId: privateForum.id, htmlContent: 'user', textContent: 'user' })];
|
|
2524
2586
|
case 25:
|
|
2525
2587
|
userSelfPost = _d.sent();
|
|
2526
2588
|
assert(!!userSelfPost, 'user private post failed', 'user private post successful');
|
|
@@ -2704,6 +2766,47 @@ var public_form_tests = function () { return __awaiter(void 0, void 0, void 0, f
|
|
|
2704
2766
|
}
|
|
2705
2767
|
});
|
|
2706
2768
|
}); };
|
|
2769
|
+
export var managed_content_records_tests = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
2770
|
+
var record, record2;
|
|
2771
|
+
return __generator(this, function (_a) {
|
|
2772
|
+
switch (_a.label) {
|
|
2773
|
+
case 0:
|
|
2774
|
+
log_header("Managed Content Records");
|
|
2775
|
+
return [4 /*yield*/, enduserSDK.register({ email: 'content@tellescope.com', password: "testenduserpassword" })];
|
|
2776
|
+
case 1:
|
|
2777
|
+
_a.sent();
|
|
2778
|
+
return [4 /*yield*/, enduserSDK.authenticate('content@tellescope.com', "testenduserpassword")];
|
|
2779
|
+
case 2:
|
|
2780
|
+
_a.sent();
|
|
2781
|
+
return [4 /*yield*/, sdk.api.managed_content_records.createOne({
|
|
2782
|
+
title: "title", htmlContent: '<br />', textContent: 'content',
|
|
2783
|
+
publicRead: true,
|
|
2784
|
+
})];
|
|
2785
|
+
case 3:
|
|
2786
|
+
record = _a.sent();
|
|
2787
|
+
return [4 /*yield*/, sdk.api.managed_content_records.createOne({
|
|
2788
|
+
title: "title 2", htmlContent: '<br />', textContent: 'content',
|
|
2789
|
+
publicRead: false,
|
|
2790
|
+
})];
|
|
2791
|
+
case 4:
|
|
2792
|
+
record2 = _a.sent();
|
|
2793
|
+
return [4 /*yield*/, async_test('enduser can access content by default (1)', function () { return enduserSDK.api.managed_content_records.getOne(record.id); }, passOnAnyResult)];
|
|
2794
|
+
case 5:
|
|
2795
|
+
_a.sent();
|
|
2796
|
+
return [4 /*yield*/, async_test('enduser can access content by default (many)', function () { return enduserSDK.api.managed_content_records.getSome(); }, { onResult: function (rs) { return rs.length === 1; } })];
|
|
2797
|
+
case 6:
|
|
2798
|
+
_a.sent();
|
|
2799
|
+
return [4 /*yield*/, Promise.all([
|
|
2800
|
+
sdk.api.endusers.deleteOne(enduserSDK.userInfo.id),
|
|
2801
|
+
sdk.api.managed_content_records.deleteOne(record.id),
|
|
2802
|
+
sdk.api.managed_content_records.deleteOne(record2.id),
|
|
2803
|
+
])];
|
|
2804
|
+
case 7:
|
|
2805
|
+
_a.sent();
|
|
2806
|
+
return [2 /*return*/];
|
|
2807
|
+
}
|
|
2808
|
+
});
|
|
2809
|
+
}); };
|
|
2707
2810
|
var NO_TEST = function () { };
|
|
2708
2811
|
var tests = {
|
|
2709
2812
|
chats: chat_tests,
|
|
@@ -2735,7 +2838,7 @@ var tests = {
|
|
|
2735
2838
|
enduser_observations: NO_TEST,
|
|
2736
2839
|
forum_posts: NO_TEST,
|
|
2737
2840
|
forums: community_tests,
|
|
2738
|
-
managed_content_records:
|
|
2841
|
+
managed_content_records: managed_content_records_tests,
|
|
2739
2842
|
post_comments: NO_TEST,
|
|
2740
2843
|
post_likes: NO_TEST,
|
|
2741
2844
|
organizations: NO_TEST,
|
|
@@ -2762,34 +2865,34 @@ var tests = {
|
|
|
2762
2865
|
return [4 /*yield*/, multi_tenant_tests()]; // should come right after setup tests
|
|
2763
2866
|
case 4:
|
|
2764
2867
|
_h.sent(); // should come right after setup tests
|
|
2765
|
-
return [4 /*yield*/,
|
|
2868
|
+
return [4 /*yield*/, role_based_access_tests()];
|
|
2766
2869
|
case 5:
|
|
2767
2870
|
_h.sent();
|
|
2768
|
-
return [4 /*yield*/,
|
|
2871
|
+
return [4 /*yield*/, public_form_tests()];
|
|
2769
2872
|
case 6:
|
|
2770
2873
|
_h.sent();
|
|
2771
|
-
return [4 /*yield*/,
|
|
2874
|
+
return [4 /*yield*/, search_tests()];
|
|
2772
2875
|
case 7:
|
|
2773
2876
|
_h.sent();
|
|
2774
|
-
return [4 /*yield*/,
|
|
2877
|
+
return [4 /*yield*/, badInputTests()];
|
|
2775
2878
|
case 8:
|
|
2776
2879
|
_h.sent();
|
|
2777
|
-
return [4 /*yield*/,
|
|
2880
|
+
return [4 /*yield*/, filterTests()];
|
|
2778
2881
|
case 9:
|
|
2779
2882
|
_h.sent();
|
|
2780
|
-
return [4 /*yield*/,
|
|
2883
|
+
return [4 /*yield*/, updatesTests()];
|
|
2781
2884
|
case 10:
|
|
2782
2885
|
_h.sent();
|
|
2783
|
-
return [4 /*yield*/,
|
|
2886
|
+
return [4 /*yield*/, threadKeyTests()];
|
|
2784
2887
|
case 11:
|
|
2785
2888
|
_h.sent();
|
|
2786
|
-
return [4 /*yield*/,
|
|
2889
|
+
return [4 /*yield*/, enduserAccessTests()];
|
|
2787
2890
|
case 12:
|
|
2788
2891
|
_h.sent();
|
|
2789
|
-
return [4 /*yield*/,
|
|
2892
|
+
return [4 /*yield*/, generateEnduserAuthTests()];
|
|
2790
2893
|
case 13:
|
|
2791
2894
|
_h.sent();
|
|
2792
|
-
return [4 /*yield*/,
|
|
2895
|
+
return [4 /*yield*/, enduser_session_tests()];
|
|
2793
2896
|
case 14:
|
|
2794
2897
|
_h.sent();
|
|
2795
2898
|
return [4 /*yield*/, enduser_redaction_tests()];
|