Skip to content
joelhooks edited this page Sep 13, 2010 · 2 revisions

equalTo matches if the item is equal (==) to the given value.

  assertThat("hi", equalTo("hi"));

strictlyEqualTo matches if the item is strictly equal (===) to the given value.

  var o1:Object = {};
  var o2:Object = {};
  assertThat(o1, strictlyEqualTo(o1"));
  assertThat(o1, not(strictlyEqualTo(o2)));

hasProperty matches if the item has a property with the given name.

  assertThat({ id: 1234, data: null }, hasProperty("data"));

hasProperty with value matches if the item has a property, and that property’s value matches the matcher.

  assertThat({ id: 1234, data: null }, hasProperty("data", nullValue()));

hasProperties matches an item if it hasProperty for each of the given fields and matchers.

  assertThat({ id: 1234, data: null }, hasProperties({
    id: greaterThan(1000),
    data: notNullValue()
  }));

instanceOf if the item is an instance of the given type.

  assertThat("waffles", instanceOf(String));

nullValue if the item is null

  assertThat(null, nullValue( ));

notNullValue if the item is not null

  assertThat("hi", notNullValue( ));