Skip to content

Boolean Assertions

Dylan Parry edited this page Sep 27, 2016 · 7 revisions

Table of Contents

  1. toBeTrue
  2. toBeFalse

toBeTrue

expect(item: boolean).toBeTrue(message?: string): this;

Asserts that the tested item is true.

Outputs optional message in case of a failed assertion.

Example

expect(2 + 2 === 4).toBeTrue();

expect(2 + 2 === 5).toBeTrue(); // Assertion Error

toBeFalse

expect(item: boolean).toBeFalse(message?: string): this;

Asserts that the tested item is false.

Outputs optional message in case of a failed assertion.

Example

expect(2 + 2 === 5).toBeFalse();

expect(2 + 2 === 4).toBeFalse(); // Assertion Error