Skip to content

Commit 1934f5a

Browse files
committed
test(nextcloud): Add dashboard tests
Signed-off-by: jld3103 <[email protected]>
1 parent f8396ef commit 1934f5a

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import 'package:test/expect.dart';
2+
import 'package:test/scaffolding.dart';
3+
4+
import 'helper.dart';
5+
6+
void main() {
7+
group(
8+
'dashboard',
9+
() {
10+
late DockerImage image;
11+
setUpAll(() async => image = await getDockerImage());
12+
13+
late DockerContainer container;
14+
late TestNextcloudClient client;
15+
setUp(() async {
16+
container = await getDockerContainer(image);
17+
client = await getTestClient(container);
18+
});
19+
tearDown(() => container.destroy());
20+
21+
test('Get widgets', () async {
22+
final response = await client.dashboard.dashboardApi.getWidgets();
23+
expect(response.ocs.data.keys, equals(['activity', 'notes', 'recommendations', 'user_status']));
24+
});
25+
26+
group('Get widget items', () {
27+
test('v1', () async {
28+
final response = await client.dashboard.dashboardApi.getWidgetItems();
29+
expect(response.ocs.data.keys, equals(['recommendations']));
30+
final items = response.ocs.data['recommendations']!;
31+
expect(items, hasLength(7));
32+
});
33+
34+
test('v2', () async {
35+
final response = await client.dashboard.dashboardApi.getWidgetItemsV2();
36+
expect(response.ocs.data.keys, equals(['recommendations']));
37+
final items = response.ocs.data['recommendations']!.items;
38+
expect(items, hasLength(7));
39+
});
40+
});
41+
},
42+
retry: retryCount,
43+
timeout: timeout,
44+
);
45+
}

0 commit comments

Comments
 (0)