Skip to content

Commit

Permalink
update existing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
koddsson committed Oct 20, 2023
1 parent f80e6bf commit 557dbef
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
18 changes: 9 additions & 9 deletions test/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,19 +171,19 @@ describe('assert', function () {

err(function(){
assert.instanceOf(new Foo(), 1, 'blah');
}, "blah: The instanceof assertion needs a constructor but number was given.");
}, "blah: The instanceof assertion needs a constructor but Number was given.");

err(function(){
assert.instanceOf(new Foo(), 'batman');
}, "The instanceof assertion needs a constructor but string was given.");
}, "The instanceof assertion needs a constructor but String was given.");

err(function(){
assert.instanceOf(new Foo(), {});
}, "The instanceof assertion needs a constructor but Object was given.");

err(function(){
assert.instanceOf(new Foo(), true);
}, "The instanceof assertion needs a constructor but boolean was given.");
}, "The instanceof assertion needs a constructor but Boolean was given.");

err(function(){
assert.instanceOf(new Foo(), null);
Expand All @@ -198,12 +198,12 @@ describe('assert', function () {
var t = new Thing();
Thing.prototype = 1337;
assert.instanceOf(t, Thing);
}, 'The instanceof assertion needs a constructor but function was given.', true);
}, 'The instanceof assertion needs a constructor but Function was given.', true);

if (typeof Symbol !== 'undefined' && typeof Symbol.hasInstance !== 'undefined') {
err(function(){
assert.instanceOf(new Foo(), Symbol());
}, "The instanceof assertion needs a constructor but symbol was given.");
}, "The instanceof assertion needs a constructor but Symbol was given.");

err(function() {
var FakeConstructor = {};
Expand Down Expand Up @@ -233,19 +233,19 @@ describe('assert', function () {

err(function(){
assert.notInstanceOf(new Foo(), 1, 'blah');
}, "blah: The instanceof assertion needs a constructor but number was given.");
}, "blah: The instanceof assertion needs a constructor but Number was given.");

err(function(){
assert.notInstanceOf(new Foo(), 'batman');
}, "The instanceof assertion needs a constructor but string was given.");
}, "The instanceof assertion needs a constructor but String was given.");

err(function(){
assert.notInstanceOf(new Foo(), {});
}, "The instanceof assertion needs a constructor but Object was given.");

err(function(){
assert.notInstanceOf(new Foo(), true);
}, "The instanceof assertion needs a constructor but boolean was given.");
}, "The instanceof assertion needs a constructor but Boolean was given.");

err(function(){
assert.notInstanceOf(new Foo(), null);
Expand All @@ -258,7 +258,7 @@ describe('assert', function () {
if (typeof Symbol !== 'undefined' && typeof Symbol.hasInstance !== 'undefined') {
err(function(){
assert.notInstanceOf(new Foo(), Symbol());
}, "The instanceof assertion needs a constructor but symbol was given.");
}, "The instanceof assertion needs a constructor but Symbol was given.");

err(function() {
var FakeConstructor = {};
Expand Down
2 changes: 1 addition & 1 deletion test/bootstrap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ if (typeof Error.captureStackTrace !== 'undefined') {
*/

globalThis.err = function globalErr (fn, val, skipStackTest) {
if (chai.util.type(fn) !== 'function')
if (chai.util.type(fn) !== 'Function')
throw new chai.AssertionError('Invalid fn');

try {
Expand Down
12 changes: 6 additions & 6 deletions test/expect.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,23 +403,23 @@ describe('expect', function () {

err(function(){
expect(new Foo()).to.an.instanceof(1, 'blah');
}, "blah: The instanceof assertion needs a constructor but number was given.");
}, "blah: The instanceof assertion needs a constructor but Number was given.");

err(function(){
expect(new Foo(), 'blah').to.an.instanceof(1);
}, "blah: The instanceof assertion needs a constructor but number was given.");
}, "blah: The instanceof assertion needs a constructor but Number was given.");

err(function(){
expect(new Foo()).to.an.instanceof('batman');
}, "The instanceof assertion needs a constructor but string was given.");
}, "The instanceof assertion needs a constructor but String was given.");

err(function(){
expect(new Foo()).to.an.instanceof({});
}, "The instanceof assertion needs a constructor but Object was given.");

err(function(){
expect(new Foo()).to.an.instanceof(true);
}, "The instanceof assertion needs a constructor but boolean was given.");
}, "The instanceof assertion needs a constructor but Boolean was given.");

err(function(){
expect(new Foo()).to.an.instanceof(null);
Expand All @@ -434,12 +434,12 @@ describe('expect', function () {
var t = new Thing();
Thing.prototype = 1337;
expect(t).to.an.instanceof(Thing);
}, 'The instanceof assertion needs a constructor but function was given.', true)
}, 'The instanceof assertion needs a constructor but Function was given.', true)

if (typeof Symbol !== 'undefined' && typeof Symbol.hasInstance !== 'undefined') {
err(function(){
expect(new Foo()).to.an.instanceof(Symbol());
}, "The instanceof assertion needs a constructor but symbol was given.");
}, "The instanceof assertion needs a constructor but Symbol was given.");

err(function() {
var FakeConstructor = {};
Expand Down
10 changes: 5 additions & 5 deletions test/should.js
Original file line number Diff line number Diff line change
Expand Up @@ -468,19 +468,19 @@ describe('should', function() {

err(function(){
new Foo().should.be.an.instanceof(1, 'blah');
}, "blah: The instanceof assertion needs a constructor but number was given.");
}, "blah: The instanceof assertion needs a constructor but Number was given.");

err(function(){
new Foo().should.be.an.instanceof('batman');
}, "The instanceof assertion needs a constructor but string was given.");
}, "The instanceof assertion needs a constructor but String was given.");

err(function(){
new Foo().should.be.an.instanceof({});
}, "The instanceof assertion needs a constructor but Object was given.");

err(function(){
new Foo().should.be.an.instanceof(true);
}, "The instanceof assertion needs a constructor but boolean was given.");
}, "The instanceof assertion needs a constructor but Boolean was given.");

err(function(){
new Foo().should.be.an.instanceof(null);
Expand All @@ -495,12 +495,12 @@ describe('should', function() {
var t = new Thing();
Thing.prototype = 1337;
t.should.be.an.instanceof(Thing);
}, 'The instanceof assertion needs a constructor but function was given.', true);
}, 'The instanceof assertion needs a constructor but Function was given.', true);

if (typeof Symbol !== 'undefined' && typeof Symbol.hasInstance !== 'undefined') {
err(function(){
new Foo().should.be.an.instanceof(Symbol());
}, "The instanceof assertion needs a constructor but symbol was given.");
}, "The instanceof assertion needs a constructor but Symbol was given.");

err(function() {
var FakeConstructor = {};
Expand Down

0 comments on commit 557dbef

Please sign in to comment.