Forráskód Böngészése

Add test to for showing user and thread associaiton and fix bug for this

sbkwgh 8 éve
szülő
commit
b16490be12
2 módosított fájl, 3 hozzáadás és 1 törlés
  1. 1 1
      models/user.js
  2. 2 0
      test/user.js

+ 1 - 1
models/user.js

@@ -24,7 +24,7 @@ module.exports = (sequelize, DataTypes) => {
 			},
 			includeOptions (lastId, limit) {
 				let models = sequelize.models
-				let options = models.Post.includeOptions()[0]
+				let options = models.Post.includeOptions()
 
 				return [{
 					model: models.Post,

+ 2 - 0
test/user.js

@@ -330,6 +330,8 @@ describe('User', () => {
 			res.body.should.have.property('username', 'adminaccount')
 			res.body.should.have.property('Posts')
 			res.body.Posts.should.have.property('length', 2)
+			res.body.Posts[0].should.have.deep.property('Thread.id', 1)
+			res.body.Posts[0].should.have.deep.property('User.username', 'adminaccount')
 		})
 
 		it('should allow pagination', async () => {