-
-
Notifications
You must be signed in to change notification settings - Fork 109
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
Test coverage for is(value)
#86
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.
Regarding TypeName.GeneratorFunction
, if GeneratorFunction
is not the actual technical term, and it really is Generator
, we should rename it to Generator
.
Other than that, looks like a solid PR. GJ man.
test/test.ts
Outdated
@@ -753,6 +800,13 @@ test('is.inRange', t => { | |||
test('is.domElement', t => { | |||
testType(t, 'domElement'); | |||
t.false(is.domElement({nodeType: 1, nodeName: 'div'})); | |||
|
|||
t.is(is(createDomElement('div')), 'HTMLDivElement'); |
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'd refactor this to something like:
const htmlTagNameToTypeName = {
span: 'HTMLSpanElement',
...
}
Object.entries(htmlTagNameToTypeName).forEach(([tagName, typeName]: string[]) => {
const domElement = createDomElement(tagName);
t.is(is(domElement), typeName);
})
Turns out |
🙌 |
Fixes #7.
I chose a slightly different path than the one suggested in the issue. There were only two minor annoyances that you might want cleaned up / tweaked:
TypeName.GeneratorFunction
has a value of'GeneratorFunction'
but the value returned fromis
is'Generator'
. If the actual string of'GeneratorFunction'
is not being used, could we change it to'Generator'
?TypeName
. They were also mixed into a single test type ofdomElement
which meant that thetypename
helper would not work properly. I don't think anything needs to be changed here; just calling it out.