Created
September 20, 2016 10:17
-
-
Save mmmmmrob/97389d41ab15fa8a291a2542f89414b1 to your computer and use it in GitHub Desktop.
wanted expectations on canned server
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
'use strict'; | |
var canned = require('canned'); | |
var http = require('http'); | |
var opts = { logger: process.stdout }; | |
var can = canned('/path/to/canned/response/folder', opts); | |
describe('Zoopla Property Listing JSON', function () { | |
var mock_server; | |
before(function () { | |
http.createServer(can).listen(3000) | |
casper.start('http://example.com/'); | |
}); | |
it('should Call 3rd Party when clicked', function () { | |
casper.thenOpen('http://example.com/something.html', function () { | |
this.clickLabel('Do Something Button'); | |
}); | |
casper.waitForUrl(/done\.html/, function () { | |
var request = can.lastPostTo('/api/some_resource'); | |
var posted_body = JSON.parse(request.body); | |
var expected = { something: true }; | |
expect(posted_body).to.eql(expected); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment