chai-things
chai-things copied to clipboard
Asserting on a property that is a specific data type
Based on chai's property assertion, I am able to do the following for an object:
expect(record).to.have.property('deleted_at').that.is.a('date);
But with chai-things, I get the following error when I try to run the following code:
expect(manyRecords).to.all.have.property('deleted_at').that.is.a('date')
## AssertionError: expected [ Array(1) ] to be a date
Although removing the data type (date) assertion does pass the test, it seems to update the target of the assertion to the provided property, instead resets to the array.
I'm currently having the exact same problem. I think that the problem is that
expect(manyRecords).to.all.have.property('deleted_at')
doesn't return the property, but instead returns this the "manyRecords" array, so our tests fails.
I think that there should be a work around, but it'd be nice to be able to apply this kind of syntax
I just started using chai-things and immediately ran into this issue.
+1
+1
I just started using mocha and chai, so I'm not sure if my issue is the same as this one, but I have an array which is a list of English word strings; the following assertion:
allWords.should.all.be.a('string')
gives me the test result:
AssertionError: expected 'AARDVARK' to be a string