diff --git a/routes/api/stream/index.js b/routes/api/stream/index.js index 942db826c..321794823 100644 --- a/routes/api/stream/index.js +++ b/routes/api/stream/index.js @@ -1,13 +1,16 @@ const express = require('express'); + const Comment = require('../../../models/comment'); const User = require('../../../models/user'); const Action = require('../../../models/action'); + const router = express.Router(); router.get('/', (req, res, next) => { const comments = Comment.findByAssetId(req.query.asset_id) || []; const users = User.findByIdArray(comments.map((comment) => comment.author_id)); const actions = Action.findByItemIdArray(comments.map((comment) => comment.id)); + res.json(comments.concat(users).concat(actions)).catch(next); }); diff --git a/tests/.eslintrc b/tests/.eslintrc.json similarity index 83% rename from tests/.eslintrc rename to tests/.eslintrc.json index 0f4ef75d7..97d8c197e 100644 --- a/tests/.eslintrc +++ b/tests/.eslintrc.json @@ -5,6 +5,6 @@ }, "extends": "eslint:recommended", "rules": { - no-undef: [1] + "no-undef": [0] } } diff --git a/tests/utils/mongoose.js b/tests/utils/mongoose.js index 7661eeb32..35083a4b3 100644 --- a/tests/utils/mongoose.js +++ b/tests/utils/mongoose.js @@ -1,10 +1,7 @@ -// Modified from https://github.com/elliotf/mocha-mongoose - var mongoose = require('mongoose'); - -// ensure the NODE_ENV is set to 'test' -// this is helpful when you would like to change behavior when testing +// Ensure the NODE_ENV is set to 'test', +// this is helpful when you would like to change behavior when testing. process.env.NODE_ENV = 'test'; beforeEach(function (done) {