Skip to content

Commit 271b7f1

Browse files
authored
chore(docs): add assert.match and assert.not.match info (#118)
* docs: added information for assert.match * docs: added information for assert.not.match * docs: added more information per requested change
1 parent a1f9bfb commit 271b7f1

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

docs/api.assert.md

+22
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,17 @@ assert.instance([1, 2, 3], Array);
8383
assert.instance(/foobar/gi, RegExp);
8484
```
8585

86+
### match(actual: string, expects: RegExp | String, msg?: Message)
87+
Assert that `actual` matches the `expects` pattern.
88+
89+
When `expects` is a regular expression, it must match the `actual` value.
90+
When `expects` is a string, it must exist within the `actual` value as a substring.
91+
92+
```js
93+
assert.match('hello world', 'wor');
94+
assert.match('hello world', /^hel/);
95+
```
96+
8697
### snapshot(actual: string, expects: string, msg?: Message)
8798
Assert that `actual` matches the `expects` multi-line string.
8899

@@ -176,6 +187,17 @@ assert.not.instance([1, 2, 3], String);
176187
assert.not.instance(/foobar/gi, Date);
177188
```
178189

190+
### not.match(actual: string, expects: RegExp | String, msg?: Message)
191+
Assert that `actual` does not match the `expects` pattern.
192+
193+
When `expects` is a regular expression, it must not match the `actual` value.
194+
When `expects` is a string, it must not exist within the `actual` value as a substring.
195+
196+
```js
197+
assert.not.match('hello world', 'other');
198+
assert.not.match('hello world', /other/g);
199+
```
200+
179201
### not.snapshot(actual: string, expects: string, msg?: Message)
180202
Assert that `actual` does not match the `expects` snapshot.
181203

0 commit comments

Comments
 (0)