-
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
Write comprehensive tests for .not.property
#76
Labels
Milestone
Comments
Alright, so: On v1.6.0 (Chai v3):$ git diff
───────────────────────────────────────────
modified: test/test.js
───────────────────────────────────────────
@ test.js:410 @ describe('chai-immutable (' + typeEnv + ')', function () {
describe('property property', function () {
it('should not affect the original assertion', function () {
expect({ x: 1 }).to.have.property('x', 1);
+
+ expect({ x: 1 }).not.to.have.property('y');
+ expect({ x: 1 }).not.to.have.property('y', 1);
});
it('should fail given an inexisting property', function () {
@ test.js:425 @ describe('chai-immutable (' + typeEnv + ')', function () {
expect(obj).not.to.have.property('z');
});
+ it('should pass using `not` given an inexisting property and value', function () {
+ var obj = Immutable.fromJS({ x: 1 });
+ expect(obj).not.to.have.property('z', 42);
+ });
+
it('should pass given an existing property', function () {
var obj = Immutable.fromJS({ x: 1 });
expect(obj).to.have.property('x'); 153 passing (141ms)
2 failing
1) chai-immutable (Node.js) BDD interface property property should not affect the original assertion:
Error: { x: 1 } has no property 'y'
at Assertion.<anonymous> (node_modules/chai/lib/chai/core/assertions.js:895:15)
at Assertion.ctx.(anonymous function) (node_modules/chai/lib/chai/utils/addMethod.js:41:25)
at Assertion.<anonymous> (chai-immutable.js:481:28)
at Assertion.ctx.(anonymous function) [as property] (node_modules/chai/lib/chai/utils/overwriteMethod.js:49:33)
at Context.<anonymous> (test/test.js:412:38)
2) chai-immutable (Node.js) BDD interface property property should pass using `not` given an inexisting property and value:
AssertionError: expected Map { "x": 1 } to have a property 'z'
at Assertion.<anonymous> (chai-immutable.js:447:21)
at Assertion.ctx.(anonymous function) [as property] (node_modules/chai/lib/chai/utils/overwriteMethod.js:49:33)
at Context.<anonymous> (test/test.js:427:33) On
|
This confirms that I need to update |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Meaning of
.not.property
changes between Chai v3 and v4 (see chaijs/chai#744) and as pointed out by #69, currently tests aren't breaking for any version.There needs to be tests proving
.not.property
works properly on v3 and breaks on v4, so the v4 transition can be done smoothly.(This is not a
chai v4
issue because it does not require Chai v4, it's the other way around.)The text was updated successfully, but these errors were encountered: