Label machine provenance and choose server before chat harness
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import 'package:pipelines_app/application/app.dart';
|
||||
import 'package:pipelines_app/application/app_router.dart';
|
||||
import 'package:pipelines_app/application/app_route.dart';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -162,6 +165,31 @@ void main() {
|
||||
oldClient.connect(Uri.parse(home.endpoints.first)),
|
||||
throwsStateError,
|
||||
);
|
||||
// A create intent must survive the root replacing the app/socket.
|
||||
final createSwitch = selected.servers!.requestNewChat('home');
|
||||
await frames(tester);
|
||||
expect(await createSwitch, isTrue);
|
||||
final creating = tester.widget<PipelinesApp>(find.byType(PipelinesApp));
|
||||
expect(creating.serverId, 'home');
|
||||
final host = tester.widget<MyApp>(find.byType(MyApp));
|
||||
final router = host.routerConfig!.routerDelegate as AppRouterDelegate;
|
||||
expect(router.route.kind, AppRouteKind.chat);
|
||||
// The new socket is connected; harness discovery belongs only to it.
|
||||
expect(find.byKey(const Key('chat-create-confirm')), findsOneWidget);
|
||||
expect(creating.servers!.newChatServerId, isNull);
|
||||
final newRequests = channels.last.outgoing
|
||||
.map((frame) => jsonDecode(frame as String))
|
||||
.toList();
|
||||
expect(
|
||||
newRequests.where((frame) => frame['type'] == 'chat_create'),
|
||||
isEmpty,
|
||||
);
|
||||
expect(
|
||||
channels[1].outgoing
|
||||
.map((frame) => jsonDecode(frame as String))
|
||||
.where((frame) => frame['type'] == 'chat_backends'),
|
||||
isEmpty,
|
||||
);
|
||||
await tester.pumpWidget(const SizedBox.shrink());
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user