Last active
November 29, 2015 21:40
-
-
Save miyamotodev123/b5319ba9e1084f82c0f3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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