Created
April 11, 2013 00:04
-
-
Save keokilee/5359541 to your computer and use it in GitHub Desktop.
Example of Mocha spec using Chai BDD assertions and SuperTest to abstract HTTP requests and responses.
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
should = require('chai').should() | |
request = require 'supertest' | |
express = require 'express' | |
api = require('../routes').api | |
describe "api", -> | |
describe "#locations", -> | |
before -> | |
@app = express() | |
@app.get('/locations', api.locations) | |
it "should return an error message if request has no latitude or longitude", (done) -> | |
request(@app).get('/locations').expect(200).end (err, res) -> | |
res.body.error.should.be.ok | |
done() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment