Added Agent Availability screen

This commit is contained in:
2026-08-31 15:27:26 +02:00
parent e7508a4c8e
commit 0561109e3c
8 changed files with 171 additions and 30 deletions
+8 -8
View File
@@ -31,9 +31,9 @@ void main() {
jsonEncode([
{
'name': 'Ada',
'type': 'Developer',
'type': 'CODER',
'lastSeen': '2026-08-28T12:00:00Z',
'status': 'Working',
'status': 'WORKING',
'tasks': [
{'name': 'Implement api layer', 'status': 'InProgress', 'progress': 42},
],
@@ -47,7 +47,7 @@ void main() {
expect(requested.toString(), 'http://api.local:5000/api/agents');
expect(agents, hasLength(1));
expect(agents.single.name, 'Ada');
expect(agents.single.type, EAgentType.developer);
expect(agents.single.type, EAgentType.coder);
expect(agents.single.status, EAgentStatus.working);
expect(agents.single.lastSeen.isUtc, isTrue);
expect(agents.single.tasks.single.name, 'Implement api layer');
@@ -76,15 +76,15 @@ void main() {
final agents = await api.agents.getAgents();
expect(agents.first.type, EAgentType.tester);
expect(agents.first.status, EAgentStatus.working);
expect(agents.first.type, EAgentType.logAnalyzer);
expect(agents.first.status, EAgentStatus.offline);
expect(agents.first.tasks, isEmpty);
expect(agents.last.type, EAgentType.unknown);
expect(agents.last.status, EAgentStatus.unknown);
});
test('throws ApiParsingException on a malformed payload', () async {
final api = apiReturning(jsonEncode([{'Type': 'Developer'}]));
final api = apiReturning(jsonEncode([{'Type': 'CODER'}]));
expect(() => api.agents.getAgents(), throwsA(isA<ApiParsingException>()));
});
@@ -147,10 +147,10 @@ void main() {
test('agent survives toJson/fromJson', () {
final original = AgentDto(
name: 'Ada',
type: EAgentType.reviewer,
type: EAgentType.securityAnalyst,
lastSeen: DateTime.utc(2026, 8, 28, 12),
tasks: const [AgentTaskDto(name: 'Review', status: 'Open')],
status: EAgentStatus.idle,
status: EAgentStatus.available,
);
final restored = AgentDto.fromJson(original.toJson());