Procházet zdrojové kódy

Add test if notifications is not an array

sbkwgh před 8 roky
rodič
revize
f691d2dfc3
1 změnil soubory, kde provedl 14 přidání a 1 odebrání
  1. 14 1
      test/notification.js

+ 14 - 1
test/notification.js

@@ -116,7 +116,20 @@ describe('Notifications', () => {
 				.send({ threadId: 1, content: 'POST 1', mentions: ['adminaccount', 123] })
 				.end((err, res) => {
 					res.should.have.status(400)
-					res.body.errors.should.contain.something.that.deep.equals(Errors.invalidParameterType('mentions', 'string'))
+					res.body.errors.should.contain.something.that.deep.equals(Errors.invalidParameterType('mention', 'string'))
+
+					done()
+				})
+		})
+
+		it('should return an error if any mentions is not an array', done => {
+			user
+				.post('/api/v1/post')
+				.set('content-type', 'application/json')
+				.send({ threadId: 1, content: 'POST 1', mentions: false })
+				.end((err, res) => {
+					res.should.have.status(400)
+					res.body.errors.should.contain.something.that.deep.equals(Errors.invalidParameterType('mentions', 'array'))
 
 					done()
 				})