I am spying a function in a method that receives an array as its main parameter. The content of that array is irrelevant for me. What I want to check is the length of that array parameter.
// Main function
public async removeUsers() {
const inactiveUsers = await this.userRepository.find({ where: { inactive: true } })
this.userRepository.remove(inactiveUsers)
}
// Test case
const spyUserRepositoryRemove = sinon.spy(UserRepository.prototype, 'remove')
[...]
expect(spyDealRepositoryRemove).to.have.been.calledOnceWith(/* Array of length X */)
Is there a way of doing this with chai or jest?