diff --git a/models/comment.js b/models/comment.js index 0f8904387..468478810 100644 --- a/models/comment.js +++ b/models/comment.js @@ -11,7 +11,7 @@ const CommentSchema = new Schema({ body: { type: String, required: [true, 'The body is required.'], - minlength: 10 + minlength: 2 }, asset_id: String, author_id: String, diff --git a/tests/models/comment.js b/tests/models/comment.js index 0f98db6ac..9fbd1d79f 100644 --- a/tests/models/comment.js +++ b/tests/models/comment.js @@ -1,6 +1,7 @@ /* eslint-env node, mocha */ require('../utils/mongoose'); + const Comment = require('../../models/comment'); const expect = require('chai').expect; @@ -8,13 +9,13 @@ describe('Comment: models', () => { var mockComments; beforeEach(() => { return Comment.create([{ - body: 'comment 1', + body: 'comment 10', asset_id: '123' },{ - body: 'comment 2', + body: 'comment 20', asset_id: '123' },{ - body: 'comment 3', + body: 'comment 30', asset_id: '456' }]).then((comments) => { mockComments = comments; @@ -25,7 +26,7 @@ describe('Comment: models', () => { it('should find a comment by id', () => { return Comment.findById(mockComments[0].id).then((result) => { expect(result).to.have.property('body') - .and.to.equal('comment 1'); + .and.to.equal('comment 10'); }); }); }); @@ -35,9 +36,9 @@ describe('Comment: models', () => { return Comment.findByAssetId('123').then((result) => { expect(result).to.have.length(2); expect(result[0]).to.have.property('body') - .and.to.equal('comment 1'); + .and.to.equal('comment 10'); expect(result[1]).to.have.property('body') - .and.to.equal('comment 2'); + .and.to.equal('comment 20'); }); }); }); diff --git a/tests/routes/api/stream/index.js b/tests/routes/api/stream/index.js index 6693ea31a..aeff010de 100644 --- a/tests/routes/api/stream/index.js +++ b/tests/routes/api/stream/index.js @@ -2,23 +2,21 @@ require('../../../utils/mongoose'); const Action = require('../../../../models/action'); const User = require('../../../../models/user'); const Comment = require('../../../../models/comment'); -const expect = require('chai').expect; -const streamRoutes = require('../../../../routes/api/stream'); describe('api/stream: routes', () => { const comments = [{ id: 'abc', - body: 'comment 1', + body: 'comment 10', asset_id: 'asset', author_id: '123' },{ id: 'def', - body: 'comment 2', + body: 'comment 20', asset_id: 'asset', author_id: '456' },{ id: 'hij', - body: 'comment 3', + body: 'comment 30', asset_id: '456' }] @@ -46,15 +44,5 @@ describe('api/stream: routes', () => { }) }) - it('should return a stream with comments, users and actions', () => { - streamRoutes('./')({ - query: { - asset_id: 'asset' - } - }, { - json: (data) => { - expect(data).to.equal(1); - } - }) - }) + it('should return a stream with comments, users and actions') })