August 2017
Beginner
374 pages
10h 41m
English
In addition to toBe and toEqual, you can match strings against regular expressions (regex) via toMatch. For example:
test('hello world contains world', () => { expect('hello world').toMatch(/world/)})
Like any matcher, it can be negated with .not:
test('hello world does not contain hi', () => { expect('hello world').not.toMatch(/hi/)})
Read now
Unlock full access