I need a way to check if a spy was called with an approximate value, like it can be done with expect(value).toBeCloseTo(3,2).
Something like this:
expect(spy).toHaveBeenCalledWith("some string", valueToBeCloseTo(3, 2))
I think you can use the calls and mostRecent helpers.
const secondArgument = spy.calls.mostRecent().args[1]; // args[0] would be the string
expect(secondArgument).toBeLessThanOrEqual(3);
expect(secondArgument).toBeGreaterThanOrEqual(2);
Check out this link for most recent and this link for toBeLessThanOrEqual and toBeGreaterThanOrEqual.