to begin with
- <string> [not] to begin with <string>
Asserts that a string begins with a given string.
expect('Hello beautiful world!', 'to begin with', 'Hello');
In case of a failing expectation you get the following output:
expect('Hello world!', 'to begin with', 'foo');
expected 'Hello world!' to begin with 'foo'
If there is a partially matching prefix you'll get a diff with the common part highlighted:
expect('Hello world!', 'to begin with', 'Hell yeah');
expected 'Hello world!' to begin with 'Hell yeah'Hello world!
This assertion can be negated using the not
flag:
expect('Hello world!', 'not to begin with', 'Heaven');
In case of a failing expectation you get the following output:
expect('Hello beautiful world!', 'not to begin with', 'Hello');
expected 'Hello beautiful world!' not to begin with 'Hello'Hello beautiful world!