to be ok

  • <any> [not] to be (ok|truthy) <string>
  • <any> [not] to be (ok|truthy)

Asserts that the value is truthy.

Alias for to be truthy.

expect(1, 'to be ok');
expect(true, 'to be ok');
expect({}, 'to be ok');
expect('foo', 'to be ok');
expect(/foo/, 'to be ok');

In case of a failing expectation you get the following output:

expect('', 'to be ok');
expected '' to be ok

This assertion can be negated using the not flag:

expect(0, 'not to be ok');
expect(false, 'not to be ok');
expect('', 'not to be ok');
expect(undefined, 'not to be ok');
expect(null, 'not to be ok');

In case of a failing expectation you get the following output:

expect({}, 'not to be ok');
expected {} not to be ok