Skip to content

Commit

Permalink
test: fix tests and use action
Browse files Browse the repository at this point in the history
  • Loading branch information
barisusakli committed Apr 11, 2024
1 parent afe597a commit acab46e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions install/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@
"nodebb-plugin-ntfy": "1.7.4",
"nodebb-plugin-spam-be-gone": "2.2.1",
"nodebb-rewards-essentials": "1.0.0",
"nodebb-theme-harmony": "1.2.47",
"nodebb-theme-harmony": "1.2.48",
"nodebb-theme-lavender": "7.1.8",
"nodebb-theme-peace": "2.2.4",
"nodebb-theme-persona": "13.3.13",
"nodebb-theme-persona": "13.3.14",
"nodebb-widget-essentials": "7.0.15",
"nodemailer": "6.9.11",
"nprogress": "0.2.0",
Expand Down
7 changes: 4 additions & 3 deletions public/src/client/account/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ define('forum/account/header', [
components.get('account/delete-content').on('click', () => AccountsDelete.content(ajaxify.data.theirid));
components.get('account/delete-all').on('click', () => AccountsDelete.purge(ajaxify.data.theirid));
components.get('account/flag').on('click', flagAccount);
components.get('account/block').on('click', toggleBlockAccount);
components.get('account/unblock').on('click', toggleBlockAccount);
components.get('account/block').on('click', () => toggleBlockAccount('block'));
components.get('account/unblock').on('click', () => toggleBlockAccount('unblock'));
};

function selectActivePill() {
Expand Down Expand Up @@ -129,10 +129,11 @@ define('forum/account/header', [
});
}

function toggleBlockAccount() {
function toggleBlockAccount(action) {
socket.emit('user.toggleBlock', {
blockeeUid: ajaxify.data.uid,
blockerUid: app.user.uid,
action,
}, function (err, blocked) {
if (err) {
return alerts.error(err);
Expand Down
4 changes: 2 additions & 2 deletions test/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -2457,7 +2457,7 @@ describe('User', () => {

describe('.toggle()', () => {
it('should toggle block', (done) => {
socketUser.toggleBlock({ uid: 1 }, { blockerUid: 1, blockeeUid: blockeeUid }, (err) => {
socketUser.toggleBlock({ uid: 1 }, { blockerUid: 1, blockeeUid: blockeeUid, action: 'block' }, (err) => {
assert.ifError(err);
User.blocks.is(blockeeUid, 1, (err, blocked) => {
assert.ifError(err);
Expand All @@ -2468,7 +2468,7 @@ describe('User', () => {
});

it('should toggle block', (done) => {
socketUser.toggleBlock({ uid: 1 }, { blockerUid: 1, blockeeUid: blockeeUid }, (err) => {
socketUser.toggleBlock({ uid: 1 }, { blockerUid: 1, blockeeUid: blockeeUid, action: 'unblock' }, (err) => {
assert.ifError(err);
User.blocks.is(blockeeUid, 1, (err, blocked) => {
assert.ifError(err);
Expand Down

0 comments on commit acab46e

Please sign in to comment.