-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathredirection_test.dart
More file actions
30 lines (27 loc) · 959 Bytes
/
redirection_test.dart
File metadata and controls
30 lines (27 loc) · 959 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import 'package:flutter_test/flutter_test.dart';
import 'package:theseus_navigator/theseus_navigator.dart';
import 'common/common.dart';
void main() {
group('Redirection', () {
test('Validation successful', () async {
final redirection = Redirection(
destination: TestDestinations.login,
validator: (destination) async => true,
);
expect(await redirection.validate(TestDestinations.home), true);
});
test('Validation failed', () async {
final redirection = Redirection(
destination: TestDestinations.login,
validator: (destination) async => false,
);
expect(await redirection.validate(TestDestinations.home), false);
});
test('No validator function should fail validation', () async {
final redirection = Redirection(
destination: TestDestinations.login,
);
expect(await redirection.validate(TestDestinations.home), false);
});
});
}