-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
feat: add hasPlugin method #3963
Conversation
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.
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.
Can you separate the test in a independent unit test case.
People do not know what is the goal for that test if it mixed in the existing one.
The unit test should includes
- function existence check (optional)
- positive use-case (e.g.
@fastify/secure-session
) - negative use-case (e.g. it should return false when the plugin is not registered)
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.
negative use-case (e.g. it should return false when the plugin is not registered)
Looking at the edited changes there is not an encapsulation test too:
root
|--- plugin 1
| |----pluging foo
| |----- plugin bar (hasPlugin foo true)
|--- plugin 2 (hasPlugin foo false)
@climba03003 @Eomm |
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.
I think the implementation is a bit too naive. See:
❯ node
Welcome to Node.js v16.15.0.
Type ".help" for more information.
> var foo = 'fastify -> plugin-FOO -> plugin-AB -> plugin-AC'
undefined
> foo.includes('plugin-A')
true
>
We need a test case that covers the above and the function needs to be written such that it will return false
.
@jsumners |
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. |
Related to fastify/fastify-secure-session#143
Checklist
npm run test
andnpm run benchmark
and the Code of conduct