expect fetchMock.lastCall('filter')).toequal bad comparison?
Closed this issue · 1 comments
th3fallen commented
For some reason if i attempt to do this...
const fetchCall = fetchMock.lastCall('path:/2/account/settings');
await waitFor(() => {
expect(fetchCall).toEqual([
'https://api.whenidev.net/2/account/settings',
{
method: 'POST',
headers: mockHeaders(),
body: JSON.stringify({
...settings,
clockin: {
...settings.clockin,
work: {
...settings.clockin.work,
enabled: true, // the important bit
},
},
payroll: {
type: 3, // the other important bit
is_onboarded: true,
},
payroll_date: '2015-08-31T12:00:00.000Z', // another important bit
attendance_alert_employee: 5,
attendance_alert_manager: 15,
}),
}],
);
});
I get
Expected: ["https://api.whenidev.net/2/account/settings", {"body": "{\"clockin\":{\"window\":15,\"mobile\":{\"enabled\":false,\"strict\":false,\"strictOut\":false,\"radius\":100},\"work\":{\"enabled\":true,\"strict\":false,\"strictOut\":false,\"radius\":100}},\"payroll\":{\"type\":3,\"is_onboarded\":true},\"payroll_date\":\"2015-08-31T12:00:00.000Z\",\"attendance_alert_employee\":5,\"attendance_alert_manager\":15}", "headers": {"W-Date-Format": "iso", "W-Token": undefined, "W-UserId": NaN}, "method": "POST"}]
Received: serializes to the same string
and it's driving me mad, has anyone else figured a way to do this sanely?
th3fallen commented
actually it appears what i want is .lastOptions instead