(received: any, expected: Function)
| 293 | }, |
| 294 | |
| 295 | toBeInstanceOf(received: any, expected: Function) { |
| 296 | const matcherName = 'toBeInstanceOf'; |
| 297 | const options: MatcherHintOptions = { |
| 298 | isNot: this.isNot, |
| 299 | promise: this.promise, |
| 300 | }; |
| 301 | |
| 302 | if (typeof expected !== 'function') { |
| 303 | throw new TypeError( |
| 304 | matcherErrorMessage( |
| 305 | matcherHint(matcherName, undefined, undefined, options), |
| 306 | `${EXPECTED_COLOR('expected')} value must be a function`, |
| 307 | printWithType('Expected', expected, printExpected), |
| 308 | ), |
| 309 | ); |
| 310 | } |
| 311 | |
| 312 | const pass = received instanceof expected; |
| 313 | |
| 314 | const message = pass |
| 315 | ? () => |
| 316 | // eslint-disable-next-line prefer-template |
| 317 | matcherHint(matcherName, undefined, undefined, options) + |
| 318 | '\n\n' + |
| 319 | printExpectedConstructorNameNot('Expected constructor', expected) + |
| 320 | (typeof received.constructor === 'function' && |
| 321 | received.constructor !== expected |
| 322 | ? printReceivedConstructorNameNot( |
| 323 | 'Received constructor', |
| 324 | received.constructor, |
| 325 | expected, |
| 326 | ) |
| 327 | : '') |
| 328 | : () => |
| 329 | // eslint-disable-next-line prefer-template |
| 330 | matcherHint(matcherName, undefined, undefined, options) + |
| 331 | '\n\n' + |
| 332 | printExpectedConstructorName('Expected constructor', expected) + |
| 333 | (isPrimitive(received) || Object.getPrototypeOf(received) === null |
| 334 | ? `\nReceived value has no prototype\nReceived value: ${printReceived( |
| 335 | received, |
| 336 | )}` |
| 337 | : typeof received.constructor === 'function' |
| 338 | ? printReceivedConstructorName( |
| 339 | 'Received constructor', |
| 340 | received.constructor, |
| 341 | ) |
| 342 | : `\nReceived value: ${printReceived(received)}`); |
| 343 | |
| 344 | return {message, pass}; |
| 345 | }, |
| 346 | |
| 347 | toBeLessThan(received: number | bigint, expected: number | bigint) { |
| 348 | const matcherName = 'toBeLessThan'; |
nothing calls this directly
no test coverage detected