Skip to content

Commit

Permalink
refactor: group constructor tests & add missing test (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
alestiago authored Aug 26, 2022
1 parent 01383ba commit 0ddc207
Showing 1 changed file with 40 additions and 27 deletions.
67 changes: 40 additions & 27 deletions test/flow_builder_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,48 @@ import 'package:flutter_test/flutter_test.dart';

void main() {
group('FlowBuilder', () {
test('throws when state is null and controller is null', () async {
expect(
() => FlowBuilder(
onGeneratePages: (dynamic _, List<Page<dynamic>> __) => [],
),
throwsAssertionError,
);
});
group('constructor', () {
test('throws when state is null and controller is null', () async {
expect(
() => FlowBuilder(
onGeneratePages: (dynamic _, List<Page<dynamic>> __) => [],
),
throwsAssertionError,
);
});

test('throws when state and controller are both provided', () async {
expect(
() => FlowBuilder(
onGeneratePages: (dynamic _, List<Page<dynamic>> __) => [],
state: '',
controller: FlowController(''),
),
throwsAssertionError,
);
});
test('throws when state and controller are both provided', () async {
expect(
() => FlowBuilder(
onGeneratePages: (dynamic _, List<Page<dynamic>> __) => [],
state: '',
controller: FlowController(''),
),
throwsAssertionError,
);
});

test('does not throw when state is null if controller is present',
() async {
expect(
() => FlowBuilder(
onGeneratePages: (dynamic _, List<Page<dynamic>> __) => [],
controller: FlowController(''),
),
isNot(throwsAssertionError),
);
test('does not throw when state is null if controller is present',
() async {
expect(
() => FlowBuilder(
onGeneratePages: (dynamic _, List<Page<dynamic>> __) => [],
controller: FlowController(''),
),
isNot(throwsAssertionError),
);
});

test('does not throw when controller is null if state is present',
() async {
expect(
() => FlowBuilder(
state: 0,
onGeneratePages: (dynamic _, List<Page<dynamic>> __) => [],
),
isNot(throwsAssertionError),
);
});
});

testWidgets(
Expand Down

0 comments on commit 0ddc207

Please sign in to comment.