Skip to content

Commit

Permalink
fixing front-end submodule deletion issue
Browse files Browse the repository at this point in the history
  • Loading branch information
karengc27 committed Oct 10, 2024
1 parent ad2c8d8 commit ed4c6ad
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
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
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

0 comments on commit ed4c6ad

Please sign in to comment.