Created
November 1, 2012 20:10
-
-
Save dangerbell/3996156 to your computer and use it in GitHub Desktop.
Mocha Example with SuperTest and Nock
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
request = require 'supertest' | |
scope = require 'nock' | |
app = require process.cwd() + '/app.coffee' | |
backend = require process.cwd() + 'lib/backend.coffee' | |
URL = | |
describe 'Collections', -> | |
describe 'show', -> | |
it "should return a 404 if the object doesn't exist", (done) -> | |
scope = nock(backend.url) | |
.filteringPath(/^\/backend\.php.*$/, "/backend.php") # ignore any GET params | |
.get("/backend.php") | |
.reply(404) | |
request(app) | |
.get("/connectors/#{connectorId}/collections/#{collectionId}") | |
.set( 'Authorization', "MoverApi app_id=embiggen app_secret=cromulent" ) | |
.end (err, res) -> | |
res.should.have.status(404) | |
scope.done() | |
done() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment