Invalid Chai property: push. Did you mean "is"?

22 views
Skip to first unread message

Greg Mackey

unread,
Dec 31, 2019, 10:17:13 AM12/31/19
to Chai.js
Hello, 
I am receiving the error 'Invalid Chai property: push. Did you mean "is"?' in my console associated with a before each that calls a factory to build an elastic search body. It appears to be failing while using push to load strings into an array. Any help would be appreciated.

Before:
    //Before Tests - Create an Elastic Search Body
    before((done=> {
   const searchParametersElasticContactSearchFactory = new ElasticContactSearchFactory();
      searchParameters.setSearchText("Ana"),
      searchParameters.setStatus({
        //isApproved: true,
        isDeleted: false,
      });

      searchBody = searchParameters.build().run();
      done();
    });


Console Output:
 1) Advanced Search Service: @odata
       "before all" hook in "Advanced Search Service: @odata":
     Error: Invalid Chai property: push. Did you mean "is"?
      at Object.proxyGetter [as get] (node_modules\chai\lib\chai\utils\proxify.js:75:17)
      at C:\git\advanced-search-service\AdvancedSearchService.Mocha\node_modules\@val\vcr-common\elastic\elastic-field-filter.js:336:28
      at Array.forEach (<anonymous>)
      at MultiFieldFilter.equal (node_modules\@val\vcr-common\elastic\elastic-field-filter.js:335:20)
      at ElasticContactSearchFactory.build (node_modules\@val\vcr-common\elastic\ElasticContactSearchFactory.js:115:78)
      at Context.<anonymous> (test\advanced-search-service.elasticAuth.ts:89:37)
      at C:\git\advanced-search-service\AdvancedSearchService.Mocha\test\advanced-search-service.elasticAuth.ts:69:7-service.elasticAuth.ts:69:7
      at processTicksAndRejections (internal/process/task_queues.js:93:5)


at C:\git\advanced-search-service\AdvancedSearchService.Mocha\node_modules\@val\vcr-common\elastic\elastic-field-filter.js:336:28:

           values.forEach(function (fvalue) {
                _this.root.push({
                    simple_query_string: Object.assign({
                        query: fvalue,
                        fields: _this.fields,
                        default_operator: "and"
                    }, options)
                });
            });
        }




  "dependencies": {
    "@elastic/elasticsearch""^7.4.0",
    "chai""^4.2.0",
    "chai-http""^4.3.0",
    "mocha""^6.2.1",
    "mocha-junit-reporter""latest",
    "ts-mocha""^6.0.0",
    "typescript""^3.6.3"
  }

Greg Mackey

unread,
Jan 8, 2020, 1:04:51 PM1/8/20
to Chai.js
Chai overwrites the should property in the elastic search factory. Looks like I have to avoid loading or calling the should assertion.
Reply all
Reply to author
Forward
0 new messages