-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests for offline mode Web request blocking #103
Conversation
This revealed a couple of issues with the way we were enabling offline mode in our tests, the way we were handling offline requests to be blocked, and the way we respond to blocked requests. All have been fixed and are now under test.
}); | ||
it('should not allow latest content retrieval from storage', function() { | ||
this.timeout(20000); | ||
return assert.fails( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we using assert.fails here,
Why not just return preq.get(...).then(function(e){assert.deepEqual(e.status, 500)}) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because .then(function(e)
would not run -- it would be shortcutted by the throwing of e
, so we need to wrap the whole thing in a try/catch
, which is what assert.fails
helps us do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, thats really useful, thanks for the explanation.
You can turn these off if you want https://travis-ci.org/wikimedia/restbase/jobs/45710252#L328? (if they are not logging some useful info, they make test look uglier ;) ) |
@HardikJ How do I change the logging level (i.e. to hide |
one way would be by changing the logging level to 'fatal' when running tests in offline mode |
Where in the code can I do this? Is it part of the |
Ah, of course. Thanks! |
Add tests for offline mode Web request blocking
This revealed a couple of issues with the way we
were enabling offline mode in our tests, the way
we were handling offline requests to be blocked,
and the way we respond to blocked requests. All
have been fixed and are now under test.