feat: type stats and event log models

This commit is contained in:
Artem Kokos
2026-04-23 21:05:37 +07:00
parent 0fdaf0bac4
commit 0c74748650
6 changed files with 303 additions and 96 deletions

View File

@@ -205,7 +205,9 @@ void main() {
final state = container.read(statsProvider);
expect(state.status, LoadStatus.data);
expect(state.data['groups'], hasLength(1));
expect(state.data.groups, hasLength(1));
expect(state.data.groups.single.targetId, 'kitchen');
expect(state.data.groups.single.totalCommands, 3);
expect(api.requestedDays, 14);
});
@@ -337,7 +339,7 @@ void main() {
final state = container.read(statsProvider);
expect(state.status, LoadStatus.empty);
expect(state.data['groups'], isEmpty);
expect(state.data.groups, isEmpty);
});
test('event log load accepts map response and exposes data state', () async {
@@ -355,6 +357,8 @@ void main() {
final state = container.read(eventLogProvider);
expect(state.status, LoadStatus.data);
expect(state.data, hasLength(1));
expect(state.data.single.action, 'toggle');
expect(state.data.single.targetId, 'kitchen');
expect(api.requestedLimit, 50);
});
@@ -504,7 +508,7 @@ void main() {
final state = container.read(statsProvider);
expect(state.status, LoadStatus.error);
expect(state.data['groups'], hasLength(1));
expect(state.data.groups, hasLength(1));
expect(state.errorMessage, contains('Backend недоступен'));
});