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

Fix error code of AVV_ERR_ROOT_PLG_BOOTED #206

Merged
merged 3 commits into from
Jun 23, 2023
Merged

Fix error code of AVV_ERR_ROOT_PLG_BOOTED #206

merged 3 commits into from
Jun 23, 2023

Conversation

mbelsky
Copy link
Contributor

@mbelsky mbelsky commented Jun 21, 2023

Hi there,

I believe there is a typo. This PR fixes it.

By making a contribution to this project, I certify that:

  • (a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

  • (b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

  • (c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

  • (d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.
    -->

Checklist

  • run npm run test
  • npm run benchmark <-- this command fails with the following error:
$ npm run benchmark                     
npm ERR! Missing script: "benchmark"
npm ERR! 
npm ERR! To see a list of scripts, run:
npm ERR!   npm run

@mbelsky mbelsky marked this pull request as ready for review June 21, 2023 09:52
@Uzlopak
Copy link
Contributor

Uzlopak commented Jun 21, 2023

Good catch. Can you provide unit tests for this?

@mbelsky
Copy link
Contributor Author

mbelsky commented Jun 21, 2023

@Uzlopak sure I can. Usually I don't cover condition-less code with unit tests so would you share any ideas what should be tested here?

As an alternative I can rewrite the error definitions in a copy-paste errors proof way:

const errors = {}

[
  ["error_name", "error_description"],
  …
].forEach(([name, description]) => {
  errors[name] = createError(name, description)
})

module.exports = {
  createError,
  ...errors,
}

Copy link
Member

@Eomm Eomm left a comment

Choose a reason for hiding this comment

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

any ideas what should be tested here?

I would just iterate the object's entries and check prop-key vs error code tbh or - how did you spot it? that could be a good test 😄

@Uzlopak
Copy link
Contributor

Uzlopak commented Jun 23, 2023

added unit test

@Uzlopak Uzlopak merged commit 1971784 into fastify:master Jun 23, 2023
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