UNPKG

assertthat

Version:
21 lines (20 loc) 896 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.assertObjectIsNotInstanceOfClass = void 0; const errors_1 = require("../../errors"); const dispel_1 = require("../../dispel/dispel"); const prettyPrint_1 = require("../../prettyPrint/typeAware/prettyPrint"); const defekt_1 = require("defekt"); const assertObjectIsNotInstanceOfClass = function (actual, // eslint-disable-next-line @typescript-eslint/ban-types expected) { if (!(actual instanceof expected)) { return (0, defekt_1.value)(); } return (0, defekt_1.error)(new errors_1.AssertionFailed({ message: 'The object is an instance of the class.', actual: (0, prettyPrint_1.prettyPrint)((0, dispel_1.dispel)(actual)), expected: `To not be an instance of:\n${expected.name}` })); }; exports.assertObjectIsNotInstanceOfClass = assertObjectIsNotInstanceOfClass;