Files
openchamber-android-native/test/subagent_readonly_test.dart
T

30 lines
980 B
Dart
Raw Normal View History

import 'package:flutter_test/flutter_test.dart';
import 'package:openchamber/api/models.dart';
import 'package:openchamber/state.dart';
void main() {
test('subagent chats are read-only unless the server allows prompting them',
() {
final app = AppState();
addTearDown(app.dispose);
final child = Session(id: 'child', title: '输出 hello', parentID: 'parent');
expect(app.promptReadOnlyFor(child), isTrue);
app.allowPromptingSubagentSessions = true;
expect(app.promptReadOnlyFor(child), isFalse);
// A lead's operator worker stays read-only until taken over, whatever the
// subagent setting says.
final worker = Session(
id: 'worker',
title: 'worker',
metadata: {
'openchamber': {'kind': 'operator-child', 'parentID': 'lead'},
},
);
expect(app.promptReadOnlyFor(worker), isTrue);
final root = Session(id: 'root', title: 'root');
expect(app.promptReadOnlyFor(root), isFalse);
});
}