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

New Matcher: .toContainAllValues([values]) #15

Closed
mattphillips opened this issue Oct 23, 2017 · 4 comments
Closed

New Matcher: .toContainAllValues([values]) #15

mattphillips opened this issue Oct 23, 2017 · 4 comments

Comments

@mattphillips
Copy link
Member

Feature Request

.toContainAllValues([values])

Use .toContainAllValues when checking if an object only contains all of the provided values.

test('passes when object only contains all of the given values', () => {
  const o = { a: 'foo', b: 'bar', c: 'baz' };
  expect(o).toContainAllValues(['foo', 'bar', 'baz']);
  expect(o).toContainAllValues(['baz', 'bar', 'foo']);
  expect(o).not.toContainAllValues(['bar', 'foo']);
});
@deerawan
Copy link
Contributor

@mattphillips can I grab this one as well?

@mattphillips
Copy link
Member Author

sure thing 😄

@deerawan
Copy link
Contributor

@mattphillips How about this case? is this correct?

  const o = { a: 'foo', b: 'bar', c: 'baz' };
  expect(o).toContainAllValues(['foo', 'bar', 'baz', 'edan']);

@mattphillips
Copy link
Member Author

Good catch with that case @deerawan I've added the logic for it 👍

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

No branches or pull requests

2 participants