Refactor uploads

This commit is contained in:
Jonathan Cremin 2016-05-25 21:03:07 +01:00
parent 75a46212da
commit f59b9a5d22
14 changed files with 297 additions and 269 deletions

View file

@ -5,20 +5,20 @@ const request = agent(app.listen());
describe('hostr-web user', function() {
describe('when POST /signin with invalid credentials', function() {
it('should not redirect to /', function(done) {
it('should not redirect to /', function() {
request.get('/signin').end(function(err, response) {
const match = response.text.match(/name="_csrf" value="([^"]+)"/);
const csrf = match[1];
request
.post('/signin')
.send({'email': 'test@hostr.co', 'password': 'test-passworddeded', '_csrf': csrf})
.expect(200, done);
.expect(200);
});
});
});
describe('when POST /signin with valid credentials', function() {
it('should redirect to /', function(done) {
it('should redirect to /', function() {
request.get('/signin').end(function(err, response) {
const match = response.text.match(/name="_csrf" value="([^"]+)"/);
const csrf = match[1];
@ -27,7 +27,7 @@ describe('hostr-web user', function() {
.send({'email': 'test@hostr.co', 'password': 'test-password', '_csrf': csrf})
.expect(302)
.expect('Location', '/')
.end(done);
.end();
});
});
});