Skip to content

Commit

Permalink
Renamed tests folder to test
Browse files Browse the repository at this point in the history
  • Loading branch information
sahat committed Feb 26, 2014
1 parent 8d0a4aa commit ca58b14
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 30 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"scripts": {
"start": "node app.js",
"test": "mocha tests/**/*.js"
"test": "mocha test/**/*.js"
},
"dependencies": {
"async": "~0.2.10",
Expand Down
12 changes: 12 additions & 0 deletions test/controllers/user_specs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
var request = require('supertest');
var app = require('../../app.js');

describe('GET /', function() {
it('should return HTTP 200', function(done) {
request(app)
.get('/')
.expect(200, done);
});
});


26 changes: 13 additions & 13 deletions tests/models/User_spec.js → test/models/User_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,34 @@ process.env.NODE_ENV = 'test';

var User = require('../../models/User');

var mocha = require('mocha')
, chai = require('chai')
, should = chai.should()
, expect = chai.expect
, mongoose = require('mongoose');
var mocha = require('mocha');
var chai = require('chai');
var should = chai.should();
var expect = chai.expect;
var mongoose = require('mongoose');

var user;

describe('User attributes', function() {
before(function(done){
before(function(done) {
user = createUser();
done();
});

it('_id is a mongoDB ObjectId', function() {
user._id.should.be.an.instanceOf(mongoose.Types.ObjectId);
});

it('email should be a string', function() {
user.email.should.be.a( 'string' );
user.email.should.be.a('string');
});

it('password should be a string', function() {
expect( user.password ).to.be.a( 'string' );
expect(user.password).to.be.a('string');
});
})

function createUser(){
function createUser() {
var user = new User({
email: getEmail(),
password: '__password__',
Expand All @@ -41,6 +41,6 @@ function createUser(){
// create unique email address
//
// TODO - use an implementation that guarantees string uniqueness
function getEmail(){
function getEmail() {
return new Date().getTime() + '@example.com';
}
16 changes: 0 additions & 16 deletions tests/controllers/user_specs.js

This file was deleted.

0 comments on commit ca58b14

Please sign in to comment.