Assert not parsable number

时间:2019-04-08 13:11:55

标签: javascript chai

How can I assert the keys of an object are not parsed as numbers?
Basically both 3 and "3" should raise an error.

I'm using Chai and this is what I have done so far:

it("shouldn't have numeric keys", () => {
  Object.keys(obj).map(key => chai.assert.isNotNumber(key));  // where key is "3"
});

This doesn't raise an error if the key is "3". Thank you.

By the way, I need this to guarantee the object property order accordingly to Does JavaScript Guarantee Object Property Order?

0 个答案:

没有答案