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

Comparator test fails if args are switched #34

Closed
STRML opened this issue Nov 14, 2016 · 1 comment
Closed

Comparator test fails if args are switched #34

STRML opened this issue Nov 14, 2016 · 1 comment

Comments

@STRML
Copy link
Contributor

STRML commented Nov 14, 2016

In work I am doing to solve #33, I noticed that this test will fail:

  it('returns true if Comparator says so even on primitives (switch arg order)', function () {
    var valueA = { a: 1 };
    var valueB = {
      a: new Matcher(function (value) {
        return typeof value === 'number';
      }),
    };
    assert(eql(valueA, valueB, { comparator: matcherComparator }) === true,
      'eql({a:1}, {a:value => typeof value === "number"}, <comparator>) === true');
  });

This only changes the argument order from the existing test. This is because only the left-hand side is checked as a primitive, when really both sides should be to ensure identical behavior.

I will fix this as part of a PR, but I believe we'll end up breaking null comparator behavior.

@lucasfcosta
Copy link
Member

Thanks for your work @STRML! Great job 😄

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