test: fix assert.reject calls

fix tests
This commit is contained in:
Barış Soner Uşaklı
2023-05-04 09:47:58 -04:00
parent 048fbcaac0
commit e0db9a8978
5 changed files with 62 additions and 21 deletions

View File

@@ -388,6 +388,9 @@ postsAPI.deleteDiff = async (caller, { pid, timestamp }) => {
};
postsAPI.getReplies = async (caller, { pid }) => {
if (!utils.isNumber(pid)) {
throw new Error('[[error:invalid-data]]');
}
const { uid } = caller;
const canRead = await privileges.posts.can('topics:read', pid, caller.uid);
if (!canRead) {

View File

@@ -279,11 +279,17 @@ topicsAPI.markRead = async (caller, { tid }) => {
};
topicsAPI.markUnread = async (caller, { tid }) => {
if (!tid || caller.uid <= 0) {
throw new Error('[[error:invalid-data]]');
}
await topics.markUnread(tid, caller.uid);
topics.pushUnreadCount(caller.uid);
};
topicsAPI.bump = async (caller, { tid }) => {
if (!tid) {
throw new Error('[[error:invalid-tid]]');
}
const isAdminOrMod = await privileges.topics.isAdminOrMod(tid, caller.uid);
if (!isAdminOrMod) {
throw new Error('[[error:no-privileges]]');