mardi 26 juillet 2016

How to check some properties values and other properties only existence?

Using chaijs, how do I check that some properties of the object are equal to something and other properties only exists in one?

Something like

return expect(profilePromise)
        .to.eventually.be.fulfilled
        .to.have.property('__data')
        .to.any.deep.equal({
          id: Number, <--------- here
          firstName: facebookProfile.first_name,
          lastName: facebookProfile.last_name,
          email: facebookProfile.email,
          gender: facebookProfile.gender,
          isPopularVerified: facebookProfile.is_verified,
          isVerified: facebookProfile.verified,
          locale: facebookProfile.locale,
          timezone: facebookProfile.timezone,

          createdOn: Number, <--------- here
          updatedOn: Number, <--------- here
        })

I want to know that I have id, createdOn and updatedOn properties, but I actually do not care about its values.

Thank you

Aucun commentaire:

Enregistrer un commentaire