Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- it("Login and post", function(done){
- superagent
- .post(URL_ROOT + "/register")
- .send({
- email: "posttest@test.com",
- password: "posttest"
- })
- .end(function(err, res){
- assert.ifError(err);
- var token = res.body.token;
- superagent
- .post(URL_ROOT + "/post")
- .send({
- content: "testing post",
- user: jwt.decode(token).id
- })
- .set("Authorization", "test_scheme " + token)
- .end(function(err, res){
- assert.ifError(err);
- assert.equal(res.body.post.content, "testing post");
- done();
- });
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement