to be empty

  • <object> [not] to be empty

Asserts that an object is empty.

expect({}, 'to be empty');

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

expect({ a: 'a', b: 'b' }, 'to be empty');
expected { a'a'b'b' } to be empty
 
{
  
a'a'
//
 
should be removed
  
b'b' 
//
 
should be removed
}

This assertion can be negated using the not flag:

expect({ a: 'a', b: 'b' }, 'not to be empty');

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

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