Skip to content

Commit

Permalink
review comments fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
solodynamo committed Sep 29, 2017
1 parent 84062b1 commit f9e5a68
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
4 changes: 4 additions & 0 deletions test/assert.js
Expand Up @@ -1456,6 +1456,10 @@ describe('assert', function () {
assert.property(undefined, 'a', 'blah');
}, "blah: Target cannot be null or undefined.");

err(function () {
assert.property({a:1}, {'a':'1'}, 'blah');
}, 'blah: the argument to property must be a string, number, or symbol');

err(function () {
assert.propertyVal(dummyObj, 'a', '2', 'blah');
}, "blah: expected { a: '1' } to have property 'a' of '2', but got '1'");
Expand Down
12 changes: 6 additions & 6 deletions test/expect.js
Expand Up @@ -1463,9 +1463,9 @@ describe('expect', function () {
expect(undefined, 'blah').to.have.property("a");
}, "blah: Target cannot be null or undefined.");

expect(function () {
expect({a:1}).to.have.property(null);
}).to.throw('the argument to property must be a string, number, or symbol');
err(function () {
expect({a:1}, 'blah').to.have.property(null)
}, "blah: the argument to property must be a string, number, or symbol");
});

it('property(name, val)', function(){
Expand Down Expand Up @@ -1760,9 +1760,9 @@ describe('expect', function () {
.to.have.nested.property('foo.bar');
}, "expected { 'foo.bar': 'baz' } to have nested property 'foo.bar'");

expect(function () {
expect({a:1}).to.have.nested.property({'a':'1'});
}).to.throw('the argument to property must be a string when using nested syntax');
err(function () {
expect({a:1}, 'blah').to.have.nested.property({'a':'1'});
}, "blah: the argument to property must be a string when using nested syntax");
});

it('nested.property(name, val)', function(){
Expand Down
12 changes: 6 additions & 6 deletions test/should.js
Expand Up @@ -1182,6 +1182,10 @@ describe('should', function() {
err(function() {
({a: {b: 1}}).should.have.own.nested.property("a.b");
}, "The \"nested\" and \"own\" flags cannot be combined.");

err(function () {
({a:1}).should.have.property(undefined);
}, "the argument to property must be a string, number, or symbol");
});

it('property(name, val)', function(){
Expand Down Expand Up @@ -1409,13 +1413,9 @@ describe('should', function() {

({a:1}).should.have.nested.property('a');

(function () {
({a:1}).should.have.nested.property('{a:1}');
}).should.not.throw('the argument to property must be a string when using nested syntax');

(function () {
err(function(){
({a:1}).should.have.nested.property({'a':'1'});
}).should.throw('the argument to property must be a string when using nested syntax');
}, "the argument to property must be a string when using nested syntax");

err(function(){
({ 'foo.bar': 'baz' }).should.have.nested.property('foo.bar');
Expand Down

0 comments on commit f9e5a68

Please sign in to comment.