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 assertion - Fuzzy object match #5

Open
SergeAstapov opened this issue Nov 3, 2019 · 1 comment
Open

New assertion - Fuzzy object match #5

SergeAstapov opened this issue Nov 3, 2019 · 1 comment

Comments

@SergeAstapov
Copy link

SergeAstapov commented Nov 3, 2019

Hi @NullVoxPopuli!

Thanks for putting these together!

Have you considered fuzzy object match similar to what Sinon.js provides?

E.g. sometimes you need to match two objects and you care about one or two or three props but other props are out of concern for the test.

Currently, you can't use assert.deepEqual() as it will compare all props and it's achievable via something like:

const { foo, bar } = myObject.someMethod();

assert.equal(foo, 'foo value');
assert.equal(bar, 'bar value');

would be nice to do something like:

const result = myObject.someMethod();

assert.fuzzyEqual(result, {
  foo: 'foo value',
  bar: 'bar value'
});

where result might contain few more props that we don't care in this test.

@NullVoxPopuli
Copy link
Owner

NullVoxPopuli commented Nov 3, 2019

ooo, that'd be cool. Def useful. @SergeAstapov, want to open a PR? :)

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

No branches or pull requests

2 participants