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
Allow maps to be passed to the empty expectation #463
Allow maps to be passed to the empty expectation #463
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.
This looks brilliant thanks very much, I'll test this in a bit when I get to my computer but looks good from what I can see. Thanks for the contribution, look forward to your suggestions etc in future :)
I'll have a look into your Windows issue as well. Does which node and windows version were you using? Having a ponder about a refactor for EmptyMatcher as well :) |
I've had a thought about a refactor here. Perhaps it makes sense to move the logic to more specific classes that all implement a similar interface instead of abstracted to a common function. E.g. ArrayMatcher, MapMatcher implement the toBeEmpty function from interface IEmptyMatcher. Should simplify the individual functions. What are your thoughts @graywolf336? |
Sounds like a fantastic idea 👍 would be allow the empty match to be extended with ease, which I like that. |
Hey @jamesadarich, Did you want to accept this PR and create a separate issue for separate matchers? |
Yep @pathurs this sounds like a great plan 👍 I'll create one now, once CI has finished we can get it merged |
thanks @graywolf336 we'll get this published soon 👍 |
Description
This allows
Map
to be used in thetoBeEmpty
expectation.Closes #462
Checklist
npm test
to make sure everything else still worksnpm run review
to ensure the code adheres to the repository standardsAdditional Information
I would love to get some feedback on the code inside the
empty-matcher
file, I do not like the nested if statements but I couldn't come up with a better way at the time.As crazy as this sounds,
Map
keys can be anything, including another object. How should thestringify
function handle them? I put a placeholder there to show the size/length of it, but I know that can be improved so it is less confusing.Also, some reason the
npm test
command is failing on my Windows machine (I'm away from my usual development environment which is Linux) at the stepnpm link && install-self
.