Skip to content
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

Complete tests for http_headers #182

Merged
merged 1 commit into from
Jun 10, 2020

Conversation

rmeritz
Copy link
Contributor

@rmeritz rmeritz commented Jun 9, 2020

  • Ignore lack of test for isBrowser because isn't very important and is
    hard to test because window is called when the file is required.
  • Add test for custom user-agent header

- Ignore lack of test for isBrowser because isn't very important and is
hard to test because `window` is called when the file is required.
- Add test for custom user-agent header
@@ -25,6 +24,7 @@ HttpHeaders.prototype.toJSON = function() {
var result = {};
forEach(this._headersByLowercasedKey, function(headerDefinition, lowercasedKey) {
var headerKey;
/* istanbul ignore next */
if (isBrowser && lowercasedKey === 'user-agent') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, the reason istanbul ignore if doesn't work here is that there are two branches involved. There's the body of the if statement (which is ignored by istanbul ignore if) and the second half of the condition expression, lowercasedKey === 'user-agent' (which is not ignored by istanbul ignore if).

We could switch the order of the expressions in the conditional. That would technically be more precise, but I wouldn't push for it. The current order is presumably more intuitive for the folks maintaining this code, and it's more important to support them than it is to improve a technicality in the coverage report.

@kasrak kasrak merged commit cbf7df4 into Airtable:master Jun 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants