jeudi 2 juillet 2015

Testing if object has multiple properties

I'm having trouble checking this object is there something I need to do to chain multiple .to.have.property statements? I believe I'm just padding the result from the past one into the next one.

expect(shopify.formatRequestOptions("shop"))
  .to.have.property('url', "https://"+settings.shop+"/admin/shop.json")
  .to.have.property('method', "GET")
  .to.have.deep.property('headers.X-Shopify-Access-Token', settings.accessToken)

It seems I can use something like this chai-subset to check an object. Is there no way to chain these together? I'd hate to have to do this.

var result = shopify.formatRequestOptions("shop")
expect(result).to.have.property('url', "https://"+settings.shop+"/admin/shop.json")
expect(result).to.have.property('method', "GET")
expect(result).to.have.deep.property('headers.X-Shopify-Access-Token', settings.accessToken)

Aucun commentaire:

Enregistrer un commentaire