UNPKG

assertthat

Version:
22 lines (21 loc) 1.07 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.assertStringIsNotContainingAllOfIterable = void 0; const errors_1 = require("../../errors"); const assertStringIsContainingString_1 = require("./assertStringIsContainingString"); const prettyPrint_1 = require("../../prettyPrint/typeAware/prettyPrint"); const defekt_1 = require("defekt"); const assertStringIsNotContainingAllOfIterable = function (actual, iterable) { for (const item of iterable) { const result = (0, assertStringIsContainingString_1.assertStringIsContainingString)(actual, item); if (result.hasError()) { return (0, defekt_1.value)(); } } return (0, defekt_1.error)(new errors_1.AssertionFailed({ message: 'The string contains all sub-strings in the iterable.', actual: (0, prettyPrint_1.prettyPrint)(actual), expected: `To not contain all of:\n${(0, prettyPrint_1.prettyPrint)(iterable)}` })); }; exports.assertStringIsNotContainingAllOfIterable = assertStringIsNotContainingAllOfIterable;