See original discussion here:
glenjamin/transit-immutable-js#13 (comment)
Notable points:
var FooRecord = Immutable.Record({ a: 1, b: 2 }, 'foo');
// This assertion passes
expect(new FooRecord()).to.eql(new Immutable.Map({a: 1, b: 2}));
// Because this is true
Immutable.is(new FooRecord(), new Immutable.Map({a: 1, b: 2}));
And this is currently by design: https://twitter.com/glenathan/status/688050710047539200
I think it'd be useful to provide a way to opt into a stricter comparison in chai-immutable. I'm unsure whether or not I think it should be the default at this point.
One suggested approach is to say that immutable object should be both equal, and stringly equal - as records include their names in the string output. This doesn't handle records with the same name though - so perhaps it would need something more complicated.
/cc @corbt
See original discussion here:
glenjamin/transit-immutable-js#13 (comment)
Notable points:
And this is currently by design: https://twitter.com/glenathan/status/688050710047539200
I think it'd be useful to provide a way to opt into a stricter comparison in
chai-immutable. I'm unsure whether or not I think it should be the default at this point.One suggested approach is to say that immutable object should be both equal, and stringly equal - as records include their names in the string output. This doesn't handle records with the same name though - so perhaps it would need something more complicated.
/cc @corbt