expectBackStack method

void expectBackStack(
  1. List<String> screens
)

Implementation

void expectBackStack(List<String> screens) {
  final history = ScreenTracker()
      .screenHistory
      .map((s) => s.screenName ?? s.screenId)
      .whereType<String>()
      .toList();
  if (history.length < screens.length) {
    throw EnsembleTestFailure(
      'Back stack too short. Expected suffix $screens, got $history',
    );
  }
  final suffix = history.sublist(history.length - screens.length);
  if (!_deepEquals(suffix, screens)) {
    throw EnsembleTestFailure(
      'Expected back stack suffix $screens, got $suffix (full: $history)',
    );
  }
}