expectApiCalled method

void expectApiCalled(
  1. String name,
  2. int times
)

Implementation

void expectApiCalled(String name, int times) {
  final api = services.api;
  if (api != null) {
    final actual = api.callCount(name);
    if (actual != times) {
      throw EnsembleTestFailure(
        'Expected API "$name" to be called $times times, got $actual.',
      );
    }
    return;
  }
  _requireHarness('api');
  if (times == 0) {
    assertions.expectApiNotCalled(name);
  } else {
    assertions.expectApiCalled(name, times);
  }
}