Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2017
460
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. it("Login and post", function(done){
  2. superagent
  3. .post(URL_ROOT + "/register")
  4. .send({
  5. email: "posttest@test.com",
  6. password: "posttest"
  7. })
  8. .end(function(err, res){
  9. assert.ifError(err);
  10. var token = res.body.token;
  11. superagent
  12. .post(URL_ROOT + "/post")
  13. .send({
  14. content: "testing post",
  15. user: jwt.decode(token).id
  16. })
  17. .set("Authorization", "test_scheme " + token)
  18. .end(function(err, res){
  19. assert.ifError(err);
  20. assert.equal(res.body.post.content, "testing post");
  21. done();
  22. });
  23. });
  24. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement