export const slowFunctionCall = async (cb: (x: X) => void): Promise<void> => {...};
In a test, I need to assert things like this:
let occurrence1Count = 0;
await slowFunctionCall((x) => {
occurrence1Count = occurrence1Count + (x.actual === expected ? 1 : 0)
});
expect(occurrence1Count).toEqual(1);
I'm going to have occurrence1Count all the way to occurrence9Count. Is there a cleaner way to write this than 9 lets at the top?