diff --git a/index.js b/index.js index cb95535..ce70e9b 100644 --- a/index.js +++ b/index.js @@ -212,6 +212,17 @@ class assertWrapper extends Helper { assert.fail(`String ${actual} doesn't contain substring ${substring}`); } } + + /** + * Check that string does not contain substring + * @param {string} actual + * @param {string} substring + */ + assertStringNotIncludes(actual, substring) { + if (actual.indexOf(substring) > 0) { + assert.fail(`String ${actual} contains substring ${substring}`); + } + } } module.exports = assertWrapper; diff --git a/readme.md b/readme.md index ca8dc8a..bcf5199 100644 --- a/readme.md +++ b/readme.md @@ -262,4 +262,16 @@ I.assertStringIncludes('mystring'. 'str'); - `actual` - tested string - `substring` - expected substring +## assertStringNotIncludes + +Check that string does not contain substring + +```js +I.assertStringNotIncludes('mystring', 'sym'); +``` + +**Parameters** + +- `actual` - tested string +- `substring` - not expected substring