ScenarioNetworkRefusal.notRecorded constructor

ScenarioNetworkRefusal.notRecorded(
  1. String method,
  2. Uri url,
  3. ScenarioNetworkStore store
)

ScenarioNetwork.replay, and the store has nothing for this exchange.

The most-read sentence in this file: it is what a suite meets the first time an endpoint moves. So it says what the store does hold for that host, and when it was written — because "the url changed" and "the recording is a year old" are the two things it is, and the store knows both.

Implementation

factory ScenarioNetworkRefusal.notRecorded(
  String method,
  Uri url,
  ScenarioNetworkStore store,
) {
  var keys = store.keys();
  var sameHost = [
    for (var key in keys)
      if (key.contains('://${url.host}')) key,
  ];
  return ScenarioNetworkRefusal._(
    method: method,
    url: url,
    outcome: 'not-recorded',
    short: 'no recording for this request',
    rest:
        'The recording holds nothing for $method $url.\n'
        '\n'
        '${_whatItHolds(keys, sameHost, url)}'
        '\n'
        'Record it:\n'
        '  fw run scenarios run --network=record\n'
        '\n'
        '${_answerIt(url)}',
  );
}