@tellescope/sdk 1.2.2 → 1.2.5
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 +2 -2
- package/lib/cjs/enduser.d.ts.map +1 -1
- package/lib/cjs/enduser.js +7 -7
- package/lib/cjs/enduser.js.map +1 -1
- package/lib/cjs/sdk.d.ts +3 -2
- package/lib/cjs/sdk.d.ts.map +1 -1
- package/lib/cjs/sdk.js +2 -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 +155 -53
- package/lib/cjs/tests/tests.js.map +1 -1
- package/lib/esm/enduser.d.ts +2 -1
- package/lib/esm/enduser.d.ts.map +1 -1
- package/lib/esm/enduser.js +7 -7
- package/lib/esm/enduser.js.map +1 -1
- package/lib/esm/sdk.d.ts +3 -1
- package/lib/esm/sdk.d.ts.map +1 -1
- package/lib/esm/sdk.js +2 -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 +153 -52
- package/lib/esm/tests/tests.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/src/enduser.ts +9 -4
- package/src/sdk.ts +11 -2
- package/src/tests/tests.ts +65 -31
package/lib/cjs/tests/tests.js
CHANGED
|
@@ -82,7 +82,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
82
82
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
83
83
|
};
|
|
84
84
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
85
|
-
exports.meetings_tests = void 0;
|
|
85
|
+
exports.managed_content_records_tests = exports.meetings_tests = void 0;
|
|
86
86
|
require('source-map-support').install();
|
|
87
87
|
var crypto_1 = __importDefault(require("crypto"));
|
|
88
88
|
var buffer = __importStar(require("buffer")); // only node >=15.7.0
|
|
@@ -923,33 +923,56 @@ var email_tests = function (queries) {
|
|
|
923
923
|
textContent: "This is at est email"
|
|
924
924
|
};
|
|
925
925
|
return [4 /*yield*/, (0, testing_1.async_test)("send-email - missing email", function () { return queries.createOne(__assign(__assign({}, testEmail), { enduserId: meNoEmail.id, logOnly: false })); }, // constraint ignored when logOnly is true
|
|
926
|
-
{ shouldError: true, onError: function (e) { return e.message === "Missing email"; } })
|
|
926
|
+
{ shouldError: true, onError: function (e) { return e.message === "Missing email"; } })
|
|
927
|
+
// await async_test(
|
|
928
|
+
// `send-email - missing consent`,
|
|
929
|
+
// () => queries.createOne({ ...testEmail, enduserId: meNoConsent.id, logOnly: false }), // constraint ignored when logOnly is true
|
|
930
|
+
// { shouldError: true, onError: e => e.message === "Missing email consent" }
|
|
931
|
+
// )
|
|
932
|
+
// await async_test(
|
|
933
|
+
// `send-email - missing consent (multiple)`,
|
|
934
|
+
// () => queries.createSome([{ ...testEmail, enduserId: meNoConsent.id, logOnly: false }, { ...testEmail, enduserId: meNoConsent.id, logOnly: false }]), // constraint ignored when logOnly is true
|
|
935
|
+
// { shouldError: true, onError: e => e.message === "Missing email consent" }
|
|
936
|
+
// )
|
|
937
|
+
];
|
|
927
938
|
case 4:
|
|
928
939
|
_a.sent();
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
940
|
+
// await async_test(
|
|
941
|
+
// `send-email - missing consent`,
|
|
942
|
+
// () => queries.createOne({ ...testEmail, enduserId: meNoConsent.id, logOnly: false }), // constraint ignored when logOnly is true
|
|
943
|
+
// { shouldError: true, onError: e => e.message === "Missing email consent" }
|
|
944
|
+
// )
|
|
945
|
+
// await async_test(
|
|
946
|
+
// `send-email - missing consent (multiple)`,
|
|
947
|
+
// () => queries.createSome([{ ...testEmail, enduserId: meNoConsent.id, logOnly: false }, { ...testEmail, enduserId: meNoConsent.id, logOnly: false }]), // constraint ignored when logOnly is true
|
|
948
|
+
// { shouldError: true, onError: e => e.message === "Missing email consent" }
|
|
949
|
+
// )
|
|
937
950
|
return [4 /*yield*/, (0, testing_1.async_test)("send-email", function () { return queries.createOne(testEmail); }, { onResult: function (t) { return !!t; } })];
|
|
938
|
-
case
|
|
951
|
+
case 5:
|
|
952
|
+
// await async_test(
|
|
953
|
+
// `send-email - missing consent`,
|
|
954
|
+
// () => queries.createOne({ ...testEmail, enduserId: meNoConsent.id, logOnly: false }), // constraint ignored when logOnly is true
|
|
955
|
+
// { shouldError: true, onError: e => e.message === "Missing email consent" }
|
|
956
|
+
// )
|
|
957
|
+
// await async_test(
|
|
958
|
+
// `send-email - missing consent (multiple)`,
|
|
959
|
+
// () => queries.createSome([{ ...testEmail, enduserId: meNoConsent.id, logOnly: false }, { ...testEmail, enduserId: meNoConsent.id, logOnly: false }]), // constraint ignored when logOnly is true
|
|
960
|
+
// { shouldError: true, onError: e => e.message === "Missing email consent" }
|
|
961
|
+
// )
|
|
939
962
|
_a.sent();
|
|
940
963
|
testEmail.subject = "Test Email (Multi-Send)";
|
|
941
964
|
testEmail.textContent = "Multiple content";
|
|
942
965
|
return [4 /*yield*/, (0, testing_1.async_test)("send-email (multiple)", function () { return queries.createSome([testEmail, testEmail, testEmail]); }, { onResult: function (t) { return !!t; } })];
|
|
943
|
-
case
|
|
966
|
+
case 6:
|
|
944
967
|
_a.sent();
|
|
945
968
|
return [4 /*yield*/, sdk.api.endusers.deleteOne(me.id)];
|
|
946
|
-
case
|
|
969
|
+
case 7:
|
|
947
970
|
_a.sent();
|
|
948
971
|
return [4 /*yield*/, sdk.api.endusers.deleteOne(meNoEmail.id)];
|
|
949
|
-
case
|
|
972
|
+
case 8:
|
|
950
973
|
_a.sent();
|
|
951
974
|
return [4 /*yield*/, sdk.api.endusers.deleteOne(meNoConsent.id)];
|
|
952
|
-
case
|
|
975
|
+
case 9:
|
|
953
976
|
_a.sent();
|
|
954
977
|
return [2 /*return*/];
|
|
955
978
|
}
|
|
@@ -977,31 +1000,55 @@ var sms_tests = function (queries) {
|
|
|
977
1000
|
message: "Test SMS",
|
|
978
1001
|
};
|
|
979
1002
|
return [4 /*yield*/, (0, testing_1.async_test)("send-sms - missing phone", function () { return queries.createOne(__assign(__assign({}, testSMS), { enduserId: meNoPhone.id, logOnly: false })); }, // constraint ignored when logOnly is true
|
|
980
|
-
{ shouldError: true, onError: function (e) { return e.message === "Missing phone"; } })
|
|
1003
|
+
{ shouldError: true, onError: function (e) { return e.message === "Missing phone"; } })
|
|
1004
|
+
// await async_test(
|
|
1005
|
+
// `send-sms - missing phone consent`,
|
|
1006
|
+
// () => queries.createOne({ ...testSMS, enduserId: meNoConsent.id, logOnly: false }), // constraint ignored when logOnly is true
|
|
1007
|
+
// { shouldError: true, onError: e => e.message === "Missing phone consent" }
|
|
1008
|
+
// )
|
|
1009
|
+
// await async_test(
|
|
1010
|
+
// `send-sms - missing phone (multiple)`,
|
|
1011
|
+
// () => queries.createSome([{ ...testSMS, enduserId: meNoPhone.id, logOnly: false }, { ...testSMS, enduserId: meNoPhone.id, logOnly: false }]),
|
|
1012
|
+
// { shouldError: true, onError: e => e.message === "Missing phone" }
|
|
1013
|
+
// )
|
|
1014
|
+
];
|
|
981
1015
|
case 4:
|
|
982
1016
|
_a.sent();
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
1017
|
+
// await async_test(
|
|
1018
|
+
// `send-sms - missing phone consent`,
|
|
1019
|
+
// () => queries.createOne({ ...testSMS, enduserId: meNoConsent.id, logOnly: false }), // constraint ignored when logOnly is true
|
|
1020
|
+
// { shouldError: true, onError: e => e.message === "Missing phone consent" }
|
|
1021
|
+
// )
|
|
1022
|
+
// await async_test(
|
|
1023
|
+
// `send-sms - missing phone (multiple)`,
|
|
1024
|
+
// () => queries.createSome([{ ...testSMS, enduserId: meNoPhone.id, logOnly: false }, { ...testSMS, enduserId: meNoPhone.id, logOnly: false }]),
|
|
1025
|
+
// { shouldError: true, onError: e => e.message === "Missing phone" }
|
|
1026
|
+
// )
|
|
990
1027
|
return [4 /*yield*/, (0, testing_1.async_test)("send-sms", function () { return queries.createOne(testSMS); }, { onResult: function (t) { return !!t; } })];
|
|
991
|
-
case
|
|
1028
|
+
case 5:
|
|
1029
|
+
// await async_test(
|
|
1030
|
+
// `send-sms - missing phone consent`,
|
|
1031
|
+
// () => queries.createOne({ ...testSMS, enduserId: meNoConsent.id, logOnly: false }), // constraint ignored when logOnly is true
|
|
1032
|
+
// { shouldError: true, onError: e => e.message === "Missing phone consent" }
|
|
1033
|
+
// )
|
|
1034
|
+
// await async_test(
|
|
1035
|
+
// `send-sms - missing phone (multiple)`,
|
|
1036
|
+
// () => queries.createSome([{ ...testSMS, enduserId: meNoPhone.id, logOnly: false }, { ...testSMS, enduserId: meNoPhone.id, logOnly: false }]),
|
|
1037
|
+
// { shouldError: true, onError: e => e.message === "Missing phone" }
|
|
1038
|
+
// )
|
|
992
1039
|
_a.sent();
|
|
993
1040
|
testSMS.message = "(Multi-Send)";
|
|
994
1041
|
return [4 /*yield*/, (0, testing_1.async_test)("send-sms (multiple)", function () { return queries.createSome([testSMS, testSMS, testSMS]); }, { onResult: function (t) { return !!t; } })];
|
|
995
|
-
case
|
|
1042
|
+
case 6:
|
|
996
1043
|
_a.sent();
|
|
997
1044
|
return [4 /*yield*/, sdk.api.endusers.deleteOne(me.id)];
|
|
998
|
-
case
|
|
1045
|
+
case 7:
|
|
999
1046
|
_a.sent();
|
|
1000
1047
|
return [4 /*yield*/, sdk.api.endusers.deleteOne(meNoPhone.id)];
|
|
1001
|
-
case
|
|
1048
|
+
case 8:
|
|
1002
1049
|
_a.sent();
|
|
1003
1050
|
return [4 /*yield*/, sdk.api.endusers.deleteOne(meNoConsent.id)];
|
|
1004
|
-
case
|
|
1051
|
+
case 9:
|
|
1005
1052
|
_a.sent();
|
|
1006
1053
|
return [2 /*return*/];
|
|
1007
1054
|
}
|
|
@@ -1038,24 +1085,37 @@ var chat_room_tests = function () { return __awaiter(void 0, void 0, void 0, fun
|
|
|
1038
1085
|
case 6:
|
|
1039
1086
|
room = _j.sent();
|
|
1040
1087
|
(0, testing_1.assert)(room.numMessages === 0, 'num mesages no update', 'num messages on creation');
|
|
1041
|
-
return [4 /*yield*/, (0, testing_1.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"; } })
|
|
1088
|
+
return [4 /*yield*/, (0, testing_1.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"; } })
|
|
1089
|
+
// await async_test(
|
|
1090
|
+
// `user_display_info for room (not a user)`,
|
|
1091
|
+
// () => sdk2.api.chat_rooms.display_info({ id: room.id }),
|
|
1092
|
+
// { shouldError: true, onError: e => e.message === "Could not find a record for the given id" }
|
|
1093
|
+
// )
|
|
1094
|
+
];
|
|
1042
1095
|
case 7:
|
|
1043
1096
|
_j.sent();
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1097
|
+
// await async_test(
|
|
1098
|
+
// `user_display_info for room (not a user)`,
|
|
1099
|
+
// () => sdk2.api.chat_rooms.display_info({ id: room.id }),
|
|
1100
|
+
// { shouldError: true, onError: e => e.message === "Could not find a record for the given id" }
|
|
1101
|
+
// )
|
|
1047
1102
|
return [4 /*yield*/, sdk.api.chats.createOne({ roomId: room.id, message: 'test message', attachments: [{ type: 'file', secureName: 'testsecurename' }] })];
|
|
1048
|
-
case
|
|
1103
|
+
case 8:
|
|
1104
|
+
// await async_test(
|
|
1105
|
+
// `user_display_info for room (not a user)`,
|
|
1106
|
+
// () => sdk2.api.chat_rooms.display_info({ id: room.id }),
|
|
1107
|
+
// { shouldError: true, onError: e => e.message === "Could not find a record for the given id" }
|
|
1108
|
+
// )
|
|
1049
1109
|
_j.sent();
|
|
1050
1110
|
return [4 /*yield*/, sdk.api.chat_rooms.getOne(room.id)];
|
|
1051
|
-
case
|
|
1111
|
+
case 9:
|
|
1052
1112
|
roomWithMessage = _j.sent();
|
|
1053
1113
|
(0, testing_1.assert)(roomWithMessage.numMessages === 1, 'num mesages no update', 'num messages on send message');
|
|
1054
1114
|
(0, testing_1.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');
|
|
1055
1115
|
(0, testing_1.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');
|
|
1056
1116
|
(0, testing_1.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');
|
|
1057
1117
|
return [4 /*yield*/, sdk.api.chat_rooms.updateOne(roomWithMessage.id, { infoForUser: (_a = {}, _a[userId] = { unreadCount: 0 }, _a) })];
|
|
1058
|
-
case
|
|
1118
|
+
case 10:
|
|
1059
1119
|
roomWithMessage = _j.sent();
|
|
1060
1120
|
(0, testing_1.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');
|
|
1061
1121
|
verifyRoomDisplayInfo = function (info) {
|
|
@@ -1089,44 +1149,44 @@ var chat_room_tests = function () { return __awaiter(void 0, void 0, void 0, fun
|
|
|
1089
1149
|
return true;
|
|
1090
1150
|
};
|
|
1091
1151
|
return [4 /*yield*/, (0, testing_1.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); } })];
|
|
1092
|
-
case
|
|
1152
|
+
case 11:
|
|
1093
1153
|
_j.sent();
|
|
1094
1154
|
return [4 /*yield*/, (0, testing_1.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); } })];
|
|
1095
|
-
case
|
|
1155
|
+
case 12:
|
|
1096
1156
|
_j.sent();
|
|
1097
1157
|
return [4 /*yield*/, sdk.api.chat_rooms.deleteOne(room.id)];
|
|
1098
|
-
case
|
|
1158
|
+
case 13:
|
|
1099
1159
|
_j.sent();
|
|
1100
1160
|
return [4 /*yield*/, sdk.api.chat_rooms.createOne({})];
|
|
1101
|
-
case
|
|
1161
|
+
case 14:
|
|
1102
1162
|
emptyRoom = _j.sent();
|
|
1103
1163
|
return [4 /*yield*/, (0, testing_1.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; } })];
|
|
1104
|
-
case
|
|
1164
|
+
case 15:
|
|
1105
1165
|
_j.sent();
|
|
1106
1166
|
return [4 /*yield*/, (0, testing_1.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"; } })];
|
|
1107
|
-
case
|
|
1167
|
+
case 16:
|
|
1108
1168
|
_j.sent();
|
|
1109
1169
|
return [4 /*yield*/, (0, testing_1.async_test)("join-room", function () { return sdk2.api.chat_rooms.join_room({ id: emptyRoom.id }); }, { onResult: function (_a) {
|
|
1110
1170
|
var room = _a.room;
|
|
1111
1171
|
return room.id === emptyRoom.id;
|
|
1112
1172
|
} })];
|
|
1113
|
-
case
|
|
1173
|
+
case 17:
|
|
1114
1174
|
_j.sent();
|
|
1115
1175
|
return [4 /*yield*/, (0, testing_1.async_test)("get-chat-room (join successful)", function () { return sdk2.api.chat_rooms.getOne(emptyRoom.id); }, { onResult: function (r) { return r.id === emptyRoom.id; } })];
|
|
1116
|
-
case
|
|
1176
|
+
case 18:
|
|
1117
1177
|
_j.sent();
|
|
1118
1178
|
return [4 /*yield*/, enduserSDK.logout()];
|
|
1119
|
-
case
|
|
1179
|
+
case 19:
|
|
1120
1180
|
_j.sent();
|
|
1121
1181
|
return [4 /*yield*/, sdk.api.endusers.getOne(enduser.id)];
|
|
1122
|
-
case
|
|
1182
|
+
case 20:
|
|
1123
1183
|
loggedOutEnduser = _j.sent();
|
|
1124
1184
|
(0, testing_1.assert)(new Date(loggedOutEnduser.lastLogout).getTime() > Date.now() - 100, 'lastLogout fail for enduser', 'lastLogout for enduser');
|
|
1125
1185
|
return [4 /*yield*/, sdk.api.endusers.deleteOne(enduser.id)];
|
|
1126
|
-
case
|
|
1186
|
+
case 21:
|
|
1127
1187
|
_j.sent();
|
|
1128
1188
|
return [4 /*yield*/, sdk.api.chat_rooms.deleteOne(emptyRoom.id)];
|
|
1129
|
-
case
|
|
1189
|
+
case 22:
|
|
1130
1190
|
_j.sent();
|
|
1131
1191
|
return [2 /*return*/];
|
|
1132
1192
|
}
|
|
@@ -1404,7 +1464,7 @@ var enduserAccessTests = function () { return __awaiter(void 0, void 0, void 0,
|
|
|
1404
1464
|
case 11: return [4 /*yield*/, (0, testing_1.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"; } })];
|
|
1405
1465
|
case 12:
|
|
1406
1466
|
_j.sent();
|
|
1407
|
-
return [4 /*yield*/, (0, testing_1.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 === "
|
|
1467
|
+
return [4 /*yield*/, (0, testing_1.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"; } })];
|
|
1408
1468
|
case 13:
|
|
1409
1469
|
_j.sent();
|
|
1410
1470
|
return [4 /*yield*/, sdk.api.tickets.createOne({ enduserId: enduser.id, title: "Accessible ticket" })];
|
|
@@ -2494,16 +2554,16 @@ var community_tests = function () { return __awaiter(void 0, void 0, void 0, fun
|
|
|
2494
2554
|
return [4 /*yield*/, (0, testing_1.async_test)("enduser access privateForum error", function () { return enduserSDK.api.forums.getOne(privateForum.id); }, handleAnyError)];
|
|
2495
2555
|
case 7:
|
|
2496
2556
|
_d.sent();
|
|
2497
|
-
return [4 /*yield*/, enduserSDK.api.forum_posts.createOne({ forumId: forum.id, htmlContent: 'enduser', textContent: 'enduser' })];
|
|
2557
|
+
return [4 /*yield*/, enduserSDK.api.forum_posts.createOne({ title: 'title', forumId: forum.id, htmlContent: 'enduser', textContent: 'enduser' })];
|
|
2498
2558
|
case 8:
|
|
2499
2559
|
enduserPost = _d.sent();
|
|
2500
2560
|
(0, testing_1.assert)(!!enduserPost, 'enduser post failed', 'enduser post successful');
|
|
2501
|
-
return [4 /*yield*/, sdk.api.forum_posts.createOne({ forumId: forum.id, htmlContent: 'user', textContent: 'user' })];
|
|
2561
|
+
return [4 /*yield*/, sdk.api.forum_posts.createOne({ title: 'title', forumId: forum.id, htmlContent: 'user', textContent: 'user' })];
|
|
2502
2562
|
case 9:
|
|
2503
2563
|
userPost = _d.sent();
|
|
2504
2564
|
(0, testing_1.assert)(!!userPost, 'user post failed', 'user post successful');
|
|
2505
2565
|
(0, testing_1.assert)(enduserPost.numComments === 0 && enduserPost.numLikes === 0, 'counts not initialized', 'counts initialized at 0');
|
|
2506
|
-
return [4 /*yield*/, (0, testing_1.async_test)("enduser post private\u00A0errors", function () { return enduserSDK.api.forum_posts.createOne({ forumId: privateForum.id, htmlContent: 'enduser', textContent: 'enduser' }); }, handleAnyError)];
|
|
2566
|
+
return [4 /*yield*/, (0, testing_1.async_test)("enduser post private\u00A0errors", function () { return enduserSDK.api.forum_posts.createOne({ title: 'title', forumId: privateForum.id, htmlContent: 'enduser', textContent: 'enduser' }); }, handleAnyError)];
|
|
2507
2567
|
case 10:
|
|
2508
2568
|
_d.sent();
|
|
2509
2569
|
return [4 /*yield*/, (0, testing_1.async_test)("enduser can access single post for forumId", function () { return enduserSDK.api.forum_posts.getOne({ forumId: forum.id }); }, passOnAnyResult)];
|
|
@@ -2550,7 +2610,7 @@ var community_tests = function () { return __awaiter(void 0, void 0, void 0, fun
|
|
|
2550
2610
|
return [4 /*yield*/, (0, testing_1.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; } })];
|
|
2551
2611
|
case 24:
|
|
2552
2612
|
_d.sent();
|
|
2553
|
-
return [4 /*yield*/, sdk.api.forum_posts.createOne({ forumId: privateForum.id, htmlContent: 'user', textContent: 'user' })];
|
|
2613
|
+
return [4 /*yield*/, sdk.api.forum_posts.createOne({ title: 'title', forumId: privateForum.id, htmlContent: 'user', textContent: 'user' })];
|
|
2554
2614
|
case 25:
|
|
2555
2615
|
userSelfPost = _d.sent();
|
|
2556
2616
|
(0, testing_1.assert)(!!userSelfPost, 'user private post failed', 'user private post successful');
|
|
@@ -2734,6 +2794,48 @@ var public_form_tests = function () { return __awaiter(void 0, void 0, void 0, f
|
|
|
2734
2794
|
}
|
|
2735
2795
|
});
|
|
2736
2796
|
}); };
|
|
2797
|
+
var managed_content_records_tests = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
2798
|
+
var record, record2;
|
|
2799
|
+
return __generator(this, function (_a) {
|
|
2800
|
+
switch (_a.label) {
|
|
2801
|
+
case 0:
|
|
2802
|
+
(0, testing_1.log_header)("Managed Content Records");
|
|
2803
|
+
return [4 /*yield*/, enduserSDK.register({ email: 'content@tellescope.com', password: "testenduserpassword" })];
|
|
2804
|
+
case 1:
|
|
2805
|
+
_a.sent();
|
|
2806
|
+
return [4 /*yield*/, enduserSDK.authenticate('content@tellescope.com', "testenduserpassword")];
|
|
2807
|
+
case 2:
|
|
2808
|
+
_a.sent();
|
|
2809
|
+
return [4 /*yield*/, sdk.api.managed_content_records.createOne({
|
|
2810
|
+
title: "title", htmlContent: '<br />', textContent: 'content',
|
|
2811
|
+
publicRead: true,
|
|
2812
|
+
})];
|
|
2813
|
+
case 3:
|
|
2814
|
+
record = _a.sent();
|
|
2815
|
+
return [4 /*yield*/, sdk.api.managed_content_records.createOne({
|
|
2816
|
+
title: "title 2", htmlContent: '<br />', textContent: 'content',
|
|
2817
|
+
publicRead: false,
|
|
2818
|
+
})];
|
|
2819
|
+
case 4:
|
|
2820
|
+
record2 = _a.sent();
|
|
2821
|
+
return [4 /*yield*/, (0, testing_1.async_test)('enduser can access content by default (1)', function () { return enduserSDK.api.managed_content_records.getOne(record.id); }, passOnAnyResult)];
|
|
2822
|
+
case 5:
|
|
2823
|
+
_a.sent();
|
|
2824
|
+
return [4 /*yield*/, (0, testing_1.async_test)('enduser can access content by default (many)', function () { return enduserSDK.api.managed_content_records.getSome(); }, { onResult: function (rs) { return rs.length === 1; } })];
|
|
2825
|
+
case 6:
|
|
2826
|
+
_a.sent();
|
|
2827
|
+
return [4 /*yield*/, Promise.all([
|
|
2828
|
+
sdk.api.endusers.deleteOne(enduserSDK.userInfo.id),
|
|
2829
|
+
sdk.api.managed_content_records.deleteOne(record.id),
|
|
2830
|
+
sdk.api.managed_content_records.deleteOne(record2.id),
|
|
2831
|
+
])];
|
|
2832
|
+
case 7:
|
|
2833
|
+
_a.sent();
|
|
2834
|
+
return [2 /*return*/];
|
|
2835
|
+
}
|
|
2836
|
+
});
|
|
2837
|
+
}); };
|
|
2838
|
+
exports.managed_content_records_tests = managed_content_records_tests;
|
|
2737
2839
|
var NO_TEST = function () { };
|
|
2738
2840
|
var tests = {
|
|
2739
2841
|
chats: chat_tests,
|
|
@@ -2765,7 +2867,7 @@ var tests = {
|
|
|
2765
2867
|
enduser_observations: NO_TEST,
|
|
2766
2868
|
forum_posts: NO_TEST,
|
|
2767
2869
|
forums: community_tests,
|
|
2768
|
-
managed_content_records:
|
|
2870
|
+
managed_content_records: exports.managed_content_records_tests,
|
|
2769
2871
|
post_comments: NO_TEST,
|
|
2770
2872
|
post_likes: NO_TEST,
|
|
2771
2873
|
organizations: NO_TEST,
|