Last active
August 29, 2015 14:19
-
-
Save NickHeiner/c096151731f31adc8e22 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // Some setup code omitted for brevity | |
| nock('https://our-backend-service.opower.it') | |
| .post('/endpoint/we/depend/on') | |
| // Make your test more interesting by declaring which headers you care about | |
| // Nock lets you declare matchers on many aspects of the request | |
| .matchHeader('Content-type', 'application/json') | |
| .reply(200, function(uri, requestBody) { | |
| t.deepEqual( | |
| requestBody, | |
| expectedRequestBody, | |
| 'request is made with the right body' | |
| ); | |
| return theResponseWeExpect; | |
| }); | |
| let response = yield request.get('https://localhost:3000/ei/x/demo'), | |
| navText = getNavText(response), | |
| expectedNavEntryItems = [ | |
| 'Home', | |
| 'Demo', | |
| 'My Energy Use', | |
| 'My Plan', | |
| 'Ways to Save' | |
| ]; | |
| t.equal( | |
| navText.length, | |
| expectedNavEntryItems.length, | |
| 'has the right number of nav entries' | |
| ); | |
| t.deepEqual(navText, expectedNavEntryItems, 'has the right nav on the page'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment