Initial commit.

This commit is contained in:
Jonathan Cremin 2015-07-09 23:01:43 +01:00
commit b48a4e92e1
169 changed files with 7538 additions and 0 deletions

33
test/api/auth.spec.js Normal file
View file

@ -0,0 +1,33 @@
import { agent } from 'supertest';
import app from '../../api/app';
const request = agent(app.listen());
describe('hostr-api auth', function(){
describe('with no credentials', function(){
it('should `throw` 401', function(done){
request
.get('/user')
.expect(401, done);
});
});
describe('with invalid credentials', function(){
it('should `throw` 401', function(done){
request
.get('/user')
.auth('user', 'invalid password')
.expect(401, done);
});
});
describe('with valid credentials', function(){
it('should call the next middleware', function(done){
request
.get('/')
.auth('test@hostr.co', 'test-password')
.expect(200, done);
});
});
});