mirror of
https://github.com/chaijs/chai
synced 2024-11-14 15:57:10 +00:00
fix instanceof rethrow test
This commit is contained in:
parent
6586e2dcbe
commit
d4fde80a3c
3 changed files with 3 additions and 26 deletions
|
@ -180,19 +180,12 @@ describe('assert', function () {
|
|||
assert.instanceOf(new Foo(), undefined);
|
||||
}, "The instanceof assertion needs a constructor but undefined was given.");
|
||||
|
||||
var expectedError;
|
||||
try {
|
||||
t instanceof Thing;
|
||||
} catch (err) {
|
||||
errMsg = '[object Object] instanceof function Thing(){} failed: ' + err.message + '.';
|
||||
}
|
||||
|
||||
err(function(){
|
||||
function Thing(){};
|
||||
var t = new Thing();
|
||||
Thing.prototype = 1337;
|
||||
assert.instanceOf(t, Thing);
|
||||
}, expectedError, true);
|
||||
}, 'The instanceof assertion needs a constructor but function was given.', true);
|
||||
|
||||
if (typeof Symbol !== 'undefined' && typeof Symbol.hasInstance !== 'undefined') {
|
||||
err(function(){
|
||||
|
|
|
@ -413,20 +413,12 @@ describe('expect', function () {
|
|||
expect(new Foo()).to.an.instanceof(undefined);
|
||||
}, "The instanceof assertion needs a constructor but undefined was given.");
|
||||
|
||||
// Different browsers may have different error messages
|
||||
var expectedError;
|
||||
try {
|
||||
t instanceof Thing;
|
||||
} catch (err) {
|
||||
errMsg = '[object Object] instanceof function Thing(){} failed: ' + err.message + '.';
|
||||
}
|
||||
|
||||
err(function(){
|
||||
function Thing(){};
|
||||
var t = new Thing();
|
||||
Thing.prototype = 1337;
|
||||
expect(t).to.an.instanceof(Thing);
|
||||
}, expectedError, true)
|
||||
}, 'The instanceof assertion needs a constructor but function was given.', true)
|
||||
|
||||
if (typeof Symbol !== 'undefined' && typeof Symbol.hasInstance !== 'undefined') {
|
||||
err(function(){
|
||||
|
|
|
@ -455,20 +455,12 @@ describe('should', function() {
|
|||
new Foo().should.be.an.instanceof(undefined);
|
||||
}, "The instanceof assertion needs a constructor but undefined was given.");
|
||||
|
||||
// Different browsers may have different error messages
|
||||
var expectedError;
|
||||
try {
|
||||
t instanceof Thing;
|
||||
} catch (err) {
|
||||
errMsg = '[object Object] instanceof function Thing(){} failed: ' + err.message + '.';
|
||||
}
|
||||
|
||||
err(function(){
|
||||
function Thing(){};
|
||||
var t = new Thing();
|
||||
Thing.prototype = 1337;
|
||||
t.should.be.an.instanceof(Thing);
|
||||
}, expectedError, true);
|
||||
}, 'The instanceof assertion needs a constructor but function was given.', true);
|
||||
|
||||
if (typeof Symbol !== 'undefined' && typeof Symbol.hasInstance !== 'undefined') {
|
||||
err(function(){
|
||||
|
|
Loading…
Reference in a new issue