chore(formatting): ran formatter

This commit is contained in:
Jon Samwell 2019-02-06 12:09:07 +11:00
parent fc5e7b8832
commit 2ccdb80a29
3 changed files with 22 additions and 23 deletions

View File

@ -4,34 +4,32 @@ import 'package:flutter_gherkin/src/hooks/hook.dart';
class AggregatedHook extends Hook {
Iterable<Hook> _orderedHooks;
void addHooks(Iterable<Hook> hooks) {
_orderedHooks = hooks.toList()
..sort((a, b) => b.priority - a.priority);
_orderedHooks = hooks.toList()..sort((a, b) => b.priority - a.priority);
}
Future<void> onBeforeRun(TestConfiguration config) async =>
await _invokeHooks((h) => h.onBeforeRun(config));
await _invokeHooks((h) => h.onBeforeRun(config));
/// Run after all scenerios in a test run have completed
Future<void> onAfterRun(TestConfiguration config) async =>
await _invokeHooks((h) => h.onAfterRun(config));
Future<void> onAfterScenarioWorldCreated(World world,
String scenario) async =>
await _invokeHooks((h) =>
h.onAfterScenarioWorldCreated(world, scenario));
await _invokeHooks((h) => h.onAfterRun(config));
Future<void> onAfterScenarioWorldCreated(
World world, String scenario) async =>
await _invokeHooks((h) => h.onAfterScenarioWorldCreated(world, scenario));
/// Run before a scenario and it steps are executed
Future<void> onBeforeScenario(TestConfiguration config,
String scenario) async =>
await _invokeHooks((h) => h.onBeforeScenario(config, scenario));
Future<void> onBeforeScenario(
TestConfiguration config, String scenario) async =>
await _invokeHooks((h) => h.onBeforeScenario(config, scenario));
/// Run after a scenario has executed
Future<void> onAfterScenario(TestConfiguration config,
String scenario) async =>
await _invokeHooks((h) => h.onAfterScenario(config, scenario));
Future<void> onAfterScenario(
TestConfiguration config, String scenario) async =>
await _invokeHooks((h) => h.onAfterScenario(config, scenario));
Future<void> _invokeHooks(Future<void> invoke(Hook h)) async {
if (_orderedHooks != null && _orderedHooks.length > 0) {
for (var hook in _orderedHooks) {

View File

@ -16,7 +16,7 @@ abstract class Hook {
/// Run after the scenario world is created but run before a scenario and its steps are executed
/// Might not be invoked if there is not a world object
Future<void> onAfterScenarioWorldCreated(World world, String scenario) =>
Future.value(null);
Future.value(null);
/// Run before a scenario and it steps are executed
Future<void> onBeforeScenario(TestConfiguration config, String scenario) =>

View File

@ -8,7 +8,8 @@ class MockStepDefinition extends StepDefinitionBase<World, Function> {
int runCount = 0;
final OnRunCode code;
MockStepDefinition([this.code, int expectedParameterCount = 0]) : super(null, expectedParameterCount);
MockStepDefinition([this.code, int expectedParameterCount = 0])
: super(null, expectedParameterCount);
@override
Future<void> onRun(Iterable parameters) async {