Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miyamotodev123/68570842c345e60d1c47 to your computer and use it in GitHub Desktop.
Save miyamotodev123/68570842c345e60d1c47 to your computer and use it in GitHub Desktop.
var app = require('../../server.js'),
should = require('should'),
request = require('supertest'),
api = request(app);
describe('testing user authentication endpoints', function () {
it('successfully created a user', function (done) {
// make a post reqeust to the /signup route
api.post('/signup')
// send an email and password as part of the request body
.send({
email: 'foobar',
password: 'password'
})
.expect(200) // check to see that the response status is the expected 200 status
.end(function (err, res) {
if (err) return done(err);
// check to see that the response body returns the expected
// json object of {redirect: '/profile'}
res.body.should.eql({redirect: '/profile'});
done();
})
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment