-
Notifications
You must be signed in to change notification settings - Fork 74
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
Enhancement: Added validation to include
#84
Conversation
Added an extra assertion to check that the include expectation is always called with just one argument. Fixes: hapijs#83
@@ -2297,7 +2320,8 @@ describe('incomplete()', () => { | |||
|
|||
const a = Code.expect(1).to; | |||
Code.expect(2).to.equal(2); | |||
Hoek.assert(Code.incomplete().length === 1); | |||
const actual = Code.incomplete(); | |||
Hoek.assert(actual.length === 1, actual); |
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'm not sure that just showing actual
is any more meaningful.
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.
Sorry, didn't mean to make this change. I'll revert it.
Fix as per [Pull request 84](hapijs#84)
@@ -1124,6 +1124,52 @@ describe('expect()', () => { | |||
Hoek.assert(!exception, exception); | |||
done(); | |||
}); | |||
|
|||
const tests = [ |
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.
This isn't what I meant. One it()
block. No tests
array. No loop. You can just use curly braces to define a scope and do a simple test inside of it so you can reuse the same variable names. See https://github.com/nodejs/node/blob/4a408321d9c4a6964c9d89a0dd09067f36b4dbfc/test/parallel/test-vm-debug-context.js#L34-L72 as an example.
Second refactor to fix tests as per [Pull request 84](hapijs#84)
Hoek.assert(exception.message === 'Can only assert include with a single parameter', exception); | ||
} | ||
|
||
{ |
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 this second test can be dropped, as the functionality is tested elsewhere.
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.
@cjihrig Done.
One last comment, then this is good to go. |
> I think this second test can be dropped, as the functionality is > tested elsewhere. > --cjihrig
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions. |
Added an extra assertion to check that the
include
expectation is alwayscalled with just one argument.
Fixes: #83