How can I test if a function arg it's a number? I got a simple function of leap year, so I'd like to test if the user inputs a number (not string nor boolean) in "year" argument.
const isLeapYear = (year) => ((year % 100 === 0) ? (year % 400 === 0) : (year % 4 === 0));
I tried to use mock function but didn't work and I have no idea of a solution. Does anybody can help me please?
it('Verify if the function argument is a number', () => {
const myMock = jest.fn(2021);
myMock.mock.calls[0].toBe(expect.any(Number));
});