Match partial objects in Chai assertions?

前端 未结 8 2070
谎友^
谎友^ 2021-01-07 18:07

I am looking for the best way to match the following:

expect([
    {
        C1: \'xxx\',
        C0: \'this causes it not to match.\'
    }
]).to.deep.incl         


        
8条回答
  •  孤城傲影
    2021-01-07 18:27

    without plugins: http://chaijs.com/api/bdd/#method_property

      expect([
        {
          C1: 'xxx',
          C0: 'this causes it not to match.'
        }
      ]).to.have.deep.property('[0].C1', 'xxx');
    

提交回复
热议问题