0

I am trying to test the testingThisFunction of the sampleClass class that looks like this.

class sampleClass {
  public async testingThisFunction(options:any): Promise<any> {
     const result = anotherClass.verifyTheParamsForThisFunction(someParamsSentBasedOnOptions); 
     if(result.data.length > 0) {
        return result.data;
     } else {
        return [];
     }
  }
}

Based on options sent to the testingThisFunction, the value of someParamsSentBasedOnOptions can change.

I need to verify the params that the verifyTheParamsForThisFunction is called with on the basis of different options values.

How can I achieve that using ts-mockito tests ?

I understand that I can use

verify(MockedAnotherClass.verifyTheParamsForThisFunction(someTestParams)).once()

However, in this case, the tests throw an error about result.data.length

Rachit Anand
  • 616
  • 5
  • 16

0 Answers0