Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test checking pin button visibility [DO NOT ACCEPT] #43

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Lint and test
on:
pull_request:
branches:
- f24
- sprint2-main
workflow_call: # Usually called from deploy

defaults:
Expand Down
Binary file modified dump.rdb
Binary file not shown.
1 change: 0 additions & 1 deletion nodebb-theme-quickstart
Submodule nodebb-theme-quickstart deleted from fa9a84
2 changes: 1 addition & 1 deletion public/src/admin/manage/categories.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,4 +318,4 @@ define('admin/manage/categories', [
}

return Categories;
});
});
20 changes: 20 additions & 0 deletions test/topics.js
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,26 @@ describe('Topic\'s', () => {
assert.strictEqual(pinned, 0);
});

// Tests whether users who aren't admin can pin button (testing admin only restriction)
// CHATGPT PRODUCED CODE LINES 705-721
it('should not display pin button for regular users', async () => {
const regularUserUid = await User.create({ username: 'regularUser' });
const topic = await topics.post({
uid: adminUid,
title: 'Topic for pin button test',
content: 'Checking pin button visibility',
cid: categoryObj.cid,
});
const { tid } = topic.topicData;
try {
await apiTopics.pin({ uid: regularUserUid }, { tids: [tid], cid: categoryObj.cid });
} catch (err) {
assert.equal(err.message, '[[error:no-privileges]]');
return;
}
assert(false, 'Regular user should not have access to the pin button');
});

it('should move all topics', (done) => {
socketTopics.moveAll({ uid: adminUid }, { cid: moveCid, currentCid: categoryObj.cid }, (err) => {
assert.ifError(err);
Expand Down