update tests
This commit is contained in:
@ -97,6 +97,7 @@
|
||||
"gulp-inject": "~1.0.2",
|
||||
"gulp-nodemon": "^2.0.3",
|
||||
"loopback-explorer": "^1.7.2",
|
||||
"loopback-testing": "^1.1.0",
|
||||
"mocha": "~2.0.1",
|
||||
"multiline": "~1.0.1",
|
||||
"supertest": "~0.15.0"
|
||||
|
@ -2,6 +2,7 @@
|
||||
"restApiRoot": "/api",
|
||||
"host": "0.0.0.0",
|
||||
"port": 3000,
|
||||
"legacyExplorer" : false,
|
||||
"remoting": {
|
||||
"context": {
|
||||
"enableHttpContext": false
|
||||
|
@ -9,7 +9,7 @@ describe('GET /', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('GET /login', function() {
|
||||
describe('GET /signin', function() {
|
||||
it('should return 200 OK', function(done) {
|
||||
request(app)
|
||||
.get('/login')
|
||||
|
@ -1,42 +0,0 @@
|
||||
var chai = require('chai');
|
||||
var should = chai.should();
|
||||
var User = require('../models/User');
|
||||
|
||||
describe('User Model', function() {
|
||||
it('should create a new user', function(done) {
|
||||
var user = new User({
|
||||
email: 'test@gmail.com',
|
||||
password: 'password'
|
||||
});
|
||||
user.save(function(err) {
|
||||
if (err) return done(err);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should not create a user with the unique email', function(done) {
|
||||
var user = new User({
|
||||
email: 'test@gmail.com',
|
||||
password: 'password'
|
||||
});
|
||||
user.save(function(err) {
|
||||
if (err) err.code.should.equal(11000);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should find user by email', function(done) {
|
||||
User.findOne({ email: 'test@gmail.com' }, function(err, user) {
|
||||
if (err) return done(err);
|
||||
user.email.should.equal('test@gmail.com');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should delete a user', function(done) {
|
||||
User.remove({ email: 'test@gmail.com' }, function(err) {
|
||||
if (err) return done(err);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user