Skip to content

Commit

Permalink
fix: #8756, pass missing req to mock
Browse files Browse the repository at this point in the history
  • Loading branch information
barisusakli committed Oct 12, 2020
1 parent 1ee9384 commit 30d6a2b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/controllers/write/posts.js
Expand Up @@ -151,7 +151,7 @@ async function mock(req) {
}

Posts.vote = async (req, res) => {
const { data, socketMock } = await mock();
const { data, socketMock } = await mock(req);

if (req.body.delta > 0) {
await socketPostHelpers.postCommand(socketMock, 'upvote', 'voted', 'notifications:upvoted_your_post_in', data);
Expand All @@ -165,21 +165,21 @@ Posts.vote = async (req, res) => {
};

Posts.unvote = async (req, res) => {
const { data, socketMock } = await mock();
const { data, socketMock } = await mock(req);

await socketPostHelpers.postCommand(socketMock, 'unvote', 'voted', '', data);
helpers.formatApiResponse(200, res);
};

Posts.bookmark = async (req, res) => {
const { data, socketMock } = await mock();
const { data, socketMock } = await mock(req);

await socketPostHelpers.postCommand(socketMock, 'bookmark', 'bookmarked', '', data);
helpers.formatApiResponse(200, res);
};

Posts.unbookmark = async (req, res) => {
const { data, socketMock } = await mock();
const { data, socketMock } = await mock(req);

await socketPostHelpers.postCommand(socketMock, 'unbookmark', 'bookmarked', '', data);
helpers.formatApiResponse(200, res);
Expand Down

0 comments on commit 30d6a2b

Please sign in to comment.