-
-
Notifications
You must be signed in to change notification settings - Fork 45
add option to encapsulate #199
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
Changes from 3 commits
8f36ab6
61cb402
5a083e3
934be7b
ccf7879
00d2bdd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -237,3 +237,38 @@ test('should check fastify dependency graph - decorateReply', t => { | |
| t.equal(err.message, "The decorator 'plugin2' required by 'test' is not present in Reply") | ||
| }) | ||
| }) | ||
|
|
||
| test('should accept an option to encapsulate', t => { | ||
| t.plan(4) | ||
| const fastify = Fastify() | ||
|
|
||
| fastify.register(fp((fastify, opts, next) => { | ||
| fastify.decorate('accessible', true) | ||
| next() | ||
| }, { | ||
| name: 'accessible-plugin' | ||
| })) | ||
|
|
||
| fastify.register(fp((fastify, opts, next) => { | ||
| fastify.decorate('alsoAccessible', true) | ||
| next() | ||
| }, { | ||
| name: 'accessible-plugin2', | ||
| encapsulate: false | ||
| })) | ||
|
|
||
| fastify.register(fp((fastify, opts, next) => { | ||
| fastify.decorate('encapsulated', true) | ||
| next() | ||
| }, { | ||
| name: 'encapsulated-plugin', | ||
| encapsulate: true | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need a test that verifies what the docs say: does it run all the validations?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would you say the 1 test is enough? I'd rather avoid repeating the whole test suite
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All the cases that have not been tested have an undetermined state, so the maintainers can't help whoever opens an issue. In this case, the maintainer should add a test case for it and add it to the repository etc.. in an endless pain loop. So, we can discuss about the minimal test suite we need, but yes: 1 test is not enough of a HUGE feature like this. So I think the minimal test suite for this test suite is:
|
||
| })) | ||
|
|
||
| fastify.ready(err => { | ||
| t.notOk(err) | ||
dwickern marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| t.ok(fastify.hasDecorator('accessible')) | ||
| t.ok(fastify.hasDecorator('alsoAccessible')) | ||
| t.notOk(fastify.hasDecorator('encapsulated')) | ||
| }) | ||
| }) | ||
Uh oh!
There was an error while loading. Please reload this page.