Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from vinitkumar/feature/add-jest
add tests with mocha, superagent
- Loading branch information
Showing
5 changed files
with
38 additions
and
10 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ services: | |
language: node_js | ||
node_js: | ||
- "4.2.4" | ||
script: npm test |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
test: | ||
@./node_modules/.bin/mocha -u tdd --reporter spec | ||
.PHONY: test |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,34 @@ | ||
var assert = require('assert'); | ||
/* global describe it */ | ||
|
||
var request = require('supertest'); | ||
var app = require('../server'); | ||
|
||
describe('Array', function () { | ||
describe('#indexOf()', function() { | ||
it('should return -1 when the value is not present', function () { | ||
assert.equal(-1, [1, 2, 3].indexOf(5)); | ||
assert.equal(-1, [1, 2, 3].indexOf(4)); | ||
describe('Test Homepage', function (done) { | ||
it('should return 302', function (done) { | ||
request(app) | ||
.get('/') | ||
.expect(302, done); | ||
}); | ||
}); | ||
|
||
describe('Test Login', function (done) { | ||
it('should return 200', function (done) { | ||
request(app) | ||
.get('/login') | ||
.expect(200, done); | ||
}); | ||
}); | ||
|
||
|
||
describe('Test Login', function (done) { | ||
it('should return 200', function (done) { | ||
request(app) | ||
.get('/apiv1/users') | ||
.expect(200) | ||
.expect('Content-Type', /json/) | ||
.end(function(err, res) { | ||
if (err) return done(err); | ||
done(); | ||
}); | ||
}); | ||
}); |