8
user1Stats.should.be.instanceof(Object);
(user1Stats).should.have.keys();

I get the following error:

Error: keys required
    at Object.Assertion.keys

The instanceof(Object) works, but I want to make sure there is no data in it.

chovy
  • 72,281
  • 52
  • 227
  • 295

2 Answers2

18
user1Stats.should.be.an.Object();
user1Stats.should.be.empty();

or, using .and to chain both asserts:

user1Stats.should.be.an.Object().and.be.empty();

P.S. By the way, your code also looks fine.

jesosk
  • 313
  • 1
  • 8
Leonid Beschastny
  • 50,364
  • 10
  • 118
  • 122
0

I check for the variable not being empty by using "should" this way:

user1Stats.should.be.empty();

calvinf
  • 3,754
  • 3
  • 28
  • 41
TulioPa
  • 177
  • 9