to be truthy

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

Asserts that the value is truthy.

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

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

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

This assertion can be negated using the not flag:

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

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

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