Last active
October 10, 2016 09:01
-
-
Save pgarrison/65077206bbf483680b286f0885170126 to your computer and use it in GitHub Desktop.
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
--- a/test/end-to-end/source-fetching-toggle.test.js | |
+++ b/test/end-to-end/source-fetching-toggle.test.js | |
@@ -29,40 +29,26 @@ describe('test duplication of reports with different settings', function() { | |
return defer.promise; | |
}; | |
- var sendRequest = function(done) { | |
+ var sendRequest = function() { | |
+ var defer = promise.defer(); | |
request('http://localhost:1111') | |
.get('/smsghana') | |
.query(reqParams) | |
.expect(200) | |
.end(function(err, res) { | |
if (err) { | |
- return done(err); | |
+ return defer.fulfill('sms gh not running'); | |
} | |
+ return defer.fulfill(res); | |
}); | |
+ return defer; | |
}; | |
- it('should listen with fetching:on and source:enabled', function(done) { | |
- chain() | |
- .then(function() { | |
- utils.addSource('SMS GH', { nickname: 'hello', keywords: 'test' }); | |
- }) | |
- .then(function() { | |
- utils.toggleFetching('On'); | |
- }) | |
- .then(function() { | |
- utils.toggleSource('SMS GH', 'On'); | |
- }) | |
- .then(function() { | |
- sendRequest(done); | |
- }); | |
+ it('should listen with fetching:on and source:enabled', function() { | |
+ utils.addSource('SMS GH', { nickname: 'hello', keywords: 'test' }); | |
+ utils.toggleFetching('On'); | |
+ utils.toggleSource('SMS GH', 'On'); | |
+ var e1 = sendRequest().then(function() { | |
+ return utils.getReports().count(); | |
+ }); | |
browser.get(browser.baseUrl + 'reports'); | |
- expect(utils.getReports().count()).to.eventually.equal(1); | |
+ var e2 = expect(e1).to.eventually.equal(1); | |
utils.toggleSource('SMS GH', 'Off'); | |
utils.toggleFetching('Off'); | |
utils.deleteSource('SMS GH', 'hello'); | |
- done(); | |
+ return e2; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment