any

Bun

Symbol

AsymmetricMatchers.any

any(constructor: (...args: any[]) => any | new (...args: any[]) => any): any

Matches anything that was created with the given constructor. You can use it inside toEqual or toBeCalledWith instead of a literal value.

function randocall(fn) {
  return fn(Math.floor(Math.random() * 6 + 1));
}

test('randocall calls its callback with a number', () => {
  const mock = jest.fn();
  randocall(mock);
  expect(mock).toBeCalledWith(expect.any(Number));
});