Populate selector catalogs for desktop UI review
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../../tool/perf/chat_catalog_fixture.dart';
|
||||
|
||||
void main() {
|
||||
test('catalogs are populated and selection is isolated per chat', () {
|
||||
final fixture = ChatCatalogFixture();
|
||||
expect(
|
||||
fixture.reply({'type': 'chat_models'})!['chat_models'],
|
||||
hasLength(2),
|
||||
);
|
||||
expect(fixture.reply({'type': 'chat_modes'})!['chat_modes'], hasLength(3));
|
||||
expect(
|
||||
fixture.reply({
|
||||
'type': 'chat_model',
|
||||
'chat_model': {
|
||||
'session_id': 'a',
|
||||
'provider': 'openai',
|
||||
'model': 'openai/gpt-5.6-luna',
|
||||
},
|
||||
})!['type'],
|
||||
'chat_model',
|
||||
);
|
||||
expect(
|
||||
fixture.reply({
|
||||
'type': 'chat_mode',
|
||||
'chat_mode': {'session_id': 'a', 'mode': 'plan'},
|
||||
})!['type'],
|
||||
'chat_mode',
|
||||
);
|
||||
expect(fixture.rowFields('a')['model'], 'openai/gpt-5.6-luna');
|
||||
expect(fixture.rowFields('a')['mode_name'], 'Plan only');
|
||||
expect(fixture.rowFields('b')['model'], 'openai/gpt-6.1');
|
||||
expect(fixture.rowFields('b')['mode'], 'default');
|
||||
});
|
||||
|
||||
test('invalid selections do not mutate catalog state', () {
|
||||
final fixture = ChatCatalogFixture();
|
||||
final before = fixture.rowFields('a');
|
||||
expect(
|
||||
fixture.reply({
|
||||
'type': 'chat_mode',
|
||||
'chat_mode': {'session_id': 'a', 'mode': 'not-a-mode'},
|
||||
})!['type'],
|
||||
'error',
|
||||
);
|
||||
expect(
|
||||
fixture.reply({
|
||||
'type': 'chat_model',
|
||||
'chat_model': {
|
||||
'session_id': 'a',
|
||||
'provider': 'unknown',
|
||||
'model': 'unknown',
|
||||
},
|
||||
})!['type'],
|
||||
'error',
|
||||
);
|
||||
expect(fixture.rowFields('a'), before);
|
||||
expect(fixture.reply({'type': 'chat_messages'}), isNull);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user