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

refactor(http): remove dead code and improve UserAgent testing #5120

Merged
merged 2 commits into from
Jun 25, 2024

Conversation

kt3k
Copy link
Member

@kt3k kt3k commented Jun 24, 2024

This PR removes some dead code and improves typings in http/user_agent.ts, and also adds test cases which exercise uncovered lines.

towards #3713

@github-actions github-actions bot added the http label Jun 24, 2024
Comment on lines -150 to -157
if (Array.isArray(str1)) {
for (const el of str1) {
if (lowerize(el) === lowerize(str2)) {
return true;
}
}
return false;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

str1 is always string with all has usages. This if-block is dead code.

Copy link

codecov bot commented Jun 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.87%. Comparing base (e276271) to head (d890236).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5120      +/-   ##
==========================================
+ Coverage   92.72%   92.87%   +0.14%     
==========================================
  Files         479      479              
  Lines       38305    38291      -14     
  Branches     5394     5399       +5     
==========================================
+ Hits        35520    35562      +42     
+ Misses       2732     2676      -56     
  Partials       53       53              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@iuioiua iuioiua left a comment

Choose a reason for hiding this comment

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

Few nits

}
return false;
}
function has(str1: string, str2: string): boolean {
return lowerize(str2).indexOf(lowerize(str1)) !== -1;
Copy link
Contributor

Choose a reason for hiding this comment

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

How about .includes()?

http/user_agent.ts Show resolved Hide resolved
@iuioiua iuioiua changed the title refactor(http): remove dead code and improve UserAgent testing refactor(http): remove dead code and improve UserAgent testing Jun 24, 2024
@kt3k kt3k merged commit 67eaa4a into denoland:main Jun 25, 2024
15 checks passed
@kt3k kt3k deleted the improve-http-user-agent-testing branch June 25, 2024 06:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants