Skip to content

Instantly share code, notes, and snippets.

@miyamotodev123
Last active November 29, 2015 21:40
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/b5319ba9e1084f82c0f3 to your computer and use it in GitHub Desktop.
Save miyamotodev123/b5319ba9e1084f82c0f3 to your computer and use it in GitHub Desktop.
var app = require('../../server.js'),
should = require('should'),
request = require('supertest'),
User = require('../../app/models/user.js'),
api = request(app);
describe('testing user authentication endpoints', function () {
beforeEach(function (done) {
User.remove({}, function() {
done();
});
});
afterEach(function (done) {
api.post('/logout')
.expect(200, done);
});
it('successfully created a user', function (done) {
api.post('/signup')
.send({
email: 'foobar',
password: 'password'
})
.expect(200)
.end(function (err, res) {
if (err) return done(err);
res.body.should.eql({redirect: '/portal'});
})
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment