expectApiCalled function
Assert that an API endpoint was called.
Implementation
void expectApiCalled(String endpoint, {String? method, int? times}) {
final wasCalled = NyMockApi.wasCalled(endpoint, method: method, times: times);
if (times != null) {
expect(
wasCalled,
isTrue,
reason: 'Expected "$endpoint" to be called $times time(s)',
);
} else {
expect(
wasCalled,
isTrue,
reason: 'Expected "$endpoint" to have been called',
);
}
}