expectApiRequestContains method

void expectApiRequestContains(
  1. String apiName, {
  2. dynamic body,
  3. dynamic query,
  4. dynamic headers,
  5. int? times,
})

Implementation

void expectApiRequestContains(
  String apiName, {
  dynamic body,
  dynamic query,
  dynamic headers,
  int? times,
}) {
  final record = _selectApiCall(apiName, times: times);

  if (body != null && !_deepContains(record.body, body)) {
    throw EnsembleTestFailure(
      'Expected API "$apiName" body to contain $body, but got ${record.body}.',
    );
  }
  if (query != null && !_deepContains(record.query, query)) {
    throw EnsembleTestFailure(
      'Expected API "$apiName" query to contain $query, but got ${record.query}.',
    );
  }
  if (headers != null && !_deepContains(record.headers, headers)) {
    throw EnsembleTestFailure(
      'Expected API "$apiName" headers to contain $headers, but got ${record.headers}.',
    );
  }
}