Advertisement
Guest User

Untitled

a guest
Jul 7th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. it('it should POST a user', () => {
  2. return co(function *() {
  3. let user = {
  4. name: "testInsertUser",
  5. password: "12345"
  6. };
  7. let res = yield chai.request(server)
  8. .post('/api/users')
  9. .send(user);
  10.  
  11. res.should.have.status(HTTPStatus.OK);
  12. res.body.should.be.a('object');
  13. res.body.should.have.property('name').eql(user.name);
  14. res.body.should.not.have.property('password');
  15.  
  16. //Find user in db
  17. let insertUser =
  18. yield models.User.findOne({
  19. where: {
  20. name: user.name,
  21. password: user.password
  22. }
  23. });
  24. res.body.should.have.property('id').eql(insertUser.id);
  25. });
  26. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement