-
Notifications
You must be signed in to change notification settings - Fork 16
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
Immutable actuals #16
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,13 @@ describe('chai-immutable', function () { | |
}); | ||
|
||
describe('equal method', function () { | ||
it( | ||
'fails when only the "expected" value is an Immutable collection', | ||
function () { | ||
assert.throws(expect([]).to.equal.bind(null, List())); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Kudos on providing failing tests beforehand :-) A few things:
That being said, the entire test suite checks that the expected behaviors but never that the proper exceptions are thrown, which is quite pointless in the end... I should work on that, thanks for reminding me :-) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Are you sure this test is passing without my fix? It isn't for me. Can you double check that? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, sorry you're right. I was seeing the other failure. I just added this one because it seemed like there should be a test for both interfaces. |
||
} | ||
); | ||
|
||
it('should be true when compared structure is equal', function () { | ||
expect(list3).to.equal(List.of(1, 2, 3)); | ||
}); | ||
|
@@ -297,6 +304,13 @@ describe('chai-immutable', function () { | |
|
||
describe('TDD interface', function () { | ||
describe('equal assertion', function () { | ||
it( | ||
'fails when only the "expected" value is an Immutable collection', | ||
function () { | ||
assert.throws(assert.equal.bind(null, [], List())); | ||
} | ||
); | ||
|
||
it('should be true when compared structure is equal', function () { | ||
assert.equal(list3, List.of(1, 2, 3)); | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@matthewwithanm, I'm not sure I see why we need this.
Currently:
which seems like what we should expect: if
obj
is not aCollection
, the equality assertion is deferred to the original assertion.Is there something I am I missing here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, yeah it doesn't seem like we do…sorry, I can't remember anymore! I can remove it and see if we stumble on why again. Sound good?