Skip to content

Commit

Permalink
Use a regex to account for property ordering issues across engines.
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Apr 7, 2015
1 parent b6f6b4f commit 517d463
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions test/expect.js
Expand Up @@ -547,7 +547,7 @@ describe('expect', function () {
expect(obj).to.have.ownPropertyDescriptor('test', descriptor);
err(function(){
expect(obj).not.to.have.ownPropertyDescriptor('test', descriptor, 'blah');
}, "blah: expected the own property descriptor for 'test' on { test: NaN } to not match { configurable: false,\n enumerable: true,\n writable: true,\n value: NaN }");
}, /^blah: expected the own property descriptor for 'test' on \{ test: NaN \} to not match \{ [^\}]+ \}$/);
err(function(){
var wrongDescriptor = {
configurable: false,
Expand All @@ -556,7 +556,7 @@ describe('expect', function () {
value: NaN
};
expect(obj).to.have.ownPropertyDescriptor('test', wrongDescriptor, 'blah');
}, "blah: expected the own property descriptor for 'test' on { test: NaN } to match { configurable: false,\n enumerable: true,\n writable: false,\n value: NaN }, got { value: NaN,\n writable: true,\n enumerable: true,\n configurable: false }");
}, /^blah: expected the own property descriptor for 'test' on \{ test: NaN \} to match \{ [^\}]+ \}, got \{ [^\}]+ \}$/);

err(function(){
expect(obj).to.have.ownPropertyDescriptor('test2', 'blah');
Expand Down
4 changes: 2 additions & 2 deletions test/should.js
Expand Up @@ -412,7 +412,7 @@ describe('should', function() {
obj.should.haveOwnPropertyDescriptor('test', descriptor);
err(function(){
obj.should.not.haveOwnPropertyDescriptor('test', descriptor, 'blah');
}, "blah: expected the own property descriptor for 'test' on { test: NaN } to not match { configurable: false,\n enumerable: true,\n writable: true,\n value: NaN }");
}, /^blah: expected the own property descriptor for 'test' on \{ test: NaN \} to not match \{ [^\}]+ \}$/);
err(function(){
var wrongDescriptor = {
configurable: false,
Expand All @@ -421,7 +421,7 @@ describe('should', function() {
value: NaN
};
obj.should.haveOwnPropertyDescriptor('test', wrongDescriptor, 'blah');
}, "blah: expected the own property descriptor for 'test' on { test: NaN } to match { configurable: false,\n enumerable: true,\n writable: false,\n value: NaN }, got { value: NaN,\n writable: true,\n enumerable: true,\n configurable: false }");
}, /^blah: expected the own property descriptor for 'test' on \{ test: NaN \} to match \{ [^\}]+ \}, got \{ [^\}]+ \}$/);

err(function(){
obj.should.haveOwnPropertyDescriptor('test2', 'blah');
Expand Down

0 comments on commit 517d463

Please sign in to comment.