Skip to content
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

Adding members and memberEquals assertions #153

Merged
merged 4 commits into from
Apr 29, 2013

Conversation

NickHeiner
Copy link

Checking for subsets and set equality. Implements #148.

Let me know if there's anything I'm doing that's not up to the project standards. I've tried to be observant.

@logicalparadox
Copy link
Member

Looks pretty good, but I do have a few comments.

  • I would still prefer that this be implemented in the same way as keys() as I outlined in this comment by using the include/contain flag for subsets.
  • Please do not include the browser build chai.js in your commit. Travis-CI will rebuild it anyway so PR CI always reflects your changes.

@logicalparadox
Copy link
Member

Official code style guideline: wiki

@NickHeiner
Copy link
Author

Thanks for the wiki link. Can you clarify exactly what you mean in terms of implementing it like keys()? Did you mean internally or externally?

Are the following syntaxes acceptable?

// subset
expect([1, 2, 3]).to.include.members([1, 2]);

// set equality
expect([1, 2, 3]).to.have.same.members([3, 2, 1])

@logicalparadox
Copy link
Member

Those syntaxes are exactly what I mean 👍

@NickHeiner
Copy link
Author

bump - any update on this?

@logicalparadox
Copy link
Member

It looks to me like members doesn't have a non-flag assertion; you need to use either same or include. What would happen if I wrote it shorthand...

expect([ 1, 2, 3 ]).members([ 3, 2, 1 ]);

You need a default assertion for your primary method. Remove same as a flag and just add it as a chainable with that and the others. Then modify members so that the same assertion is the default if no flags are set. Then we should be good to go.

@NickHeiner
Copy link
Author

bump

@logicalparadox
Copy link
Member

Sorry about delay ... I didn't get notified about your push. Looks good. Merging!

logicalparadox added a commit that referenced this pull request Apr 29, 2013
Adding members and memberEquals assertions
@logicalparadox logicalparadox merged commit 387ee31 into chaijs:master Apr 29, 2013
@NickHeiner
Copy link
Author

Awesome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants