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

Added support of containingAllOf #18

Merged
merged 3 commits into from Nov 12, 2016

Conversation

GaneshSPatil
Copy link
Contributor

@GaneshSPatil GaneshSPatil commented Nov 8, 2016

containingAllOf helps to assert whether a subArray is a subset of the actualArray or not.

Example:

var numbers = [1, 2, 3];

assert.that(numbers).is.containingAllOf([1]);
assert.that(numbers).is.containingAllOf([2, 3]);
assert.that(numbers).is.containingAllOf([1, 2, 3]);

assert.that(numbers).is.not.containingAllOf([5]);
assert.that(numbers).is.not.containingAllOf([1, 5]);
assert.that(numbers).is.not.containingAllOf([1, 2, 5]);

@GaneshSPatil GaneshSPatil changed the title Added support of containingAll Added support of containingAllOf Nov 8, 2016
@goloroden
Copy link
Member

Hi @GaneshSPatil :-)

Just to make sure I get things right: The new function checks whether all of the expected values are contained within actual, but it would even be okay if it contained other elements, right?

So it basically is a subset check, isn't it?

Since I merged #19 before this one, there are now some conflicts. Would you mind resolving them?

…elements are the part of actual collection'

(Checks whether Array containsAll subArray)
@GaneshSPatil
Copy link
Contributor Author

Hey @goloroden,
containingAllOf checks whether the all the elements of expected are present in actual.
expected need not contain all the elements of actual.
And expected can not contain any element which is not present in actual.

For Example:

assert.that([1, 2 3, 4]).is.containingAllOf([1]);
assert.that([1, 2 3, 4]).is.containingAllOf([1, 2]);
assert.that([1, 2 3, 4]).is.containingAllOf([1, 2, 3, 4]);

assert.that([1, 2 3, 4]).is.not.containingAllOf([1, 2, 5]);

@goloroden
Copy link
Member

Okay, then I got it right. Thanks for the clarification :-)

And thanks for updating the PR that fast :-)

@goloroden
Copy link
Member

And PS: Once again - really great work :-)

Thank you so much for submitting your ideas and code, and for taking the time to do all this! I really appreciate that!

A new version will be out in the next ~10 minutes.

@goloroden goloroden merged commit 61a284b into thenativeweb:master Nov 12, 2016
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.

None yet

2 participants