feat(app): compose live Runs with deep links and reconnect retention
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/application/app_route.dart';
|
||||
|
||||
void main() {
|
||||
test('parses each destination and a run detail', () {
|
||||
expect(AppRoute.parse('/pipelines'), AppRoute.pipelines);
|
||||
expect(AppRoute.parse('/runs'), AppRoute.runs);
|
||||
expect(AppRoute.parse('/runs/12'), AppRoute.run(12));
|
||||
expect(AppRoute.parse('/chat'), AppRoute.chat);
|
||||
expect(AppRoute.parse('/settings'), AppRoute.settings);
|
||||
});
|
||||
|
||||
test('normalises slashes and accepts a full URL, query and fragment', () {
|
||||
expect(AppRoute.parse('/runs/'), AppRoute.runs);
|
||||
expect(AppRoute.parse('/pipelines///'), AppRoute.pipelines);
|
||||
expect(
|
||||
AppRoute.parse('http://127.0.0.1:8096/runs/7?action=decide#top'),
|
||||
AppRoute.run(7),
|
||||
);
|
||||
expect(AppRoute.parse('/runs/7/'), AppRoute.run(7));
|
||||
});
|
||||
|
||||
test('a malformed or unknown location is the default Pipelines route', () {
|
||||
for (final path in [
|
||||
'',
|
||||
'/',
|
||||
'/runs/abc',
|
||||
'/runs/0',
|
||||
'/runs/-1',
|
||||
'/runs/1/extra',
|
||||
'/pipelines/2',
|
||||
'/chat/session',
|
||||
'/unknown',
|
||||
'/runs/%E0%A4%A',
|
||||
]) {
|
||||
expect(AppRoute.parse(path), AppRoute.pipelines, reason: path);
|
||||
}
|
||||
});
|
||||
|
||||
test('serialises every route back to a parsable path', () {
|
||||
for (final route in [
|
||||
AppRoute.pipelines,
|
||||
AppRoute.runs,
|
||||
AppRoute.run(3),
|
||||
AppRoute.chat,
|
||||
AppRoute.settings,
|
||||
]) {
|
||||
expect(AppRoute.parse(route.path), route);
|
||||
}
|
||||
expect(AppRoute.run(3).path, '/runs/3');
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user