0

I am new to web components, and am using LIT framework. I have been breaking my head trying to figure this out. This is my function.

createObj() {
this.financingObj = [];
if (this.dropDownValue === common.ONCE) {
  if (this.ammountEntered >= 2000 && this.ammountEntered <= 999999) {
    this.financingObj.push(this.createFinancingStructure('BusinessLoan'));
  }
  if (this.ammountEntered >= 10000 && this.ammountEntered <= common.MAX_ALLOWED_VALUE) {
    this.financingObj.push(this.createFinancingStructure('Leasing'));
  }
  if (this.ammountEntered >= 250000 && this.ammountEntered <= common.MAX_ALLOWED_VALUE) {
    this.financingObj.push(this.createFinancingStructure('InvestmentLoan'));
  }
  if (this.ammountEntered >= 2500000 && this.ammountEntered <= common.MAX_ALLOWED_VALUE) {
    this.financingObj = this.financingObj.filter(
      item => item !== this.createFinancingStructure('BusinessLoan'),
    );
    this.financingObj.push(this.createFinancingStructure('RollOverTermLoan'));
  }
} else if (this.dropDownValue === common.MULTIPLE_TIMES) {
  if (this.ammountEntered >= 250000 && this.ammountEntered <= common.MAX_ALLOWED_VALUE) {
    this.financingObj.push(this.createFinancingStructure('InvestmentLoan'));
  }
  if (this.ammountEntered >= 2500000 && this.ammountEntered <= common.MAX_ALLOWED_VALUE) {
    this.financingObj.push(
      this.createFinancingStructure('RollOverTermLoan'),
      this.createFinancingStructure('RollOverRevolving'),
    );
  }
}

}

And this is my test case

  it('should call createObjForInvest when invest product is selected', () => {
const spy = sinon.spy(element, 'createObj');
spy();
sinon.assert.called(spy);

});

I see the function gets called, but I am getting the following error.

enter image description here

John
  • 161
  • 1
  • 3
  • 7

0 Answers0