GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Improve test coverage by Gesma94 · Pull Request #153 · fastify/busboy

Conversation

@Gesma94

@Gesma94 Gesma94 commented Apr 29, 2024

Copy link
Copy Markdown
Contributor

To help obtain 100% coverage from #126, I've added few tests. Also, few comments on some files that are still not 100% covered:

  • decodeText.js still misses line 97 and 98. Though, I'm not sure they will ever be hit:

    1. this keyword at line 96 is used, but the method is an arrow function which is called via bind(charset) from line 42; though, I'm afraid that, being an arrow function, the scope of the this inside of it will not be the passed value of charset
    2. Supposing we change from an arrow function to a function, I don't see how the if statement at line 96 will pass: we ask if the textDecoders has the given charset, where textDecoders includes utf-8 and utf8. But, if the charset passed at line 42 is one of the two values, then another branch of the switch statement is taken.
  • urlencoded.js still misses line 118 and 164, but again, I'm not sure that they will ever be hit.

    • In order to not enter the if statement at line 118, p needs to be higher than len, and the only way I figured out is the loop for at line 58, where inside at line 59 we have if (!this._checkingBytes) { ++p }
    • In order to enter this last if, this._checkingBytes must be false, which happens at line 112, which is inside an else if (this._hitLimit)
    • Thus, I need this._hitlimit equals to true, but.. If that happens, since that if else statement is before the last else at line 117 which leads to line 118, the line 118 cannot be reached with p being greater or equals to len
    • For what concern line 164, the reasoning is basically the same, since the only difference is that, for line 164, we are working on the parameter value, while for line 118 we are working for the parameter name

Of course, I may be wrong for both files: I tried to go through all the code and understanding it, but maybe I'm missing some pieces.

Checklist

  • run npm run test and npm run benchmark
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message and code follows the Developer's Certification of Origin
    and the Code of conduct

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Gesma94 added 6 commits April 29, 2024 10:16
@Gesma94
test: 100% branch coverage in parseParam.js
03c4b91
@Gesma94
test: 100% branch coverage in Decoder.js
9322223
@Gesma94
test: improve branch coverage in urlencode.js
31f7f6e
@Gesma94
test: 100% test coverage in sbmh.js
17c37ca
@Gesma94
test: 100% branch coverage in main.js
2721d50
@Gesma94
chore: fix linting
7971cf2
gurgunday
gurgunday approved these changes May 11, 2024
View reviewed changes
@gurgunday
gurgunday requested a review from Uzlopak May 15, 2024 22:22
gurgunday
gurgunday approved these changes May 21, 2024
View reviewed changes

@gurgunday gurgunday left a comment

Copy link
Copy Markdown
Member

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.

lgtm

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@gurgunday
gurgunday merged commit 8080532 into fastify:master May 21, 2024
@gurgunday gurgunday mentioned this pull request May 21, 2024
100 % test coverage #126
Closed
2 tasks done
@github-actions

github-actions Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators May 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@gurgunday gurgunday gurgunday approved these changes
@Uzlopak Uzlopak Awaiting requested review from Uzlopak

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@Gesma94 @gurgunday
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.