Skip to content

Commit

Permalink
refactor(nextcloud): Remove duplicate nested test groups
Browse files Browse the repository at this point in the history
Signed-off-by: jld3103 <[email protected]>
  • Loading branch information
provokateurin committed Dec 9, 2023
1 parent 866d1c1 commit f181bda
Show file tree
Hide file tree
Showing 12 changed files with 2,120 additions and 2,120 deletions.
341 changes: 170 additions & 171 deletions packages/nextcloud/test/core_test.dart

Large diffs are not rendered by default.

93 changes: 46 additions & 47 deletions packages/nextcloud/test/dashboard_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,53 @@ import 'package:test_api/src/backend/invoker.dart';
import 'package:version/version.dart';

void main() {
presets('server', (final preset) {
group(
'dashboard',
() {
late DockerContainer container;
late NextcloudClient client;
setUp(() async {
container = await DockerContainer.create(preset);
client = await TestNextcloudClient.create(container);
});
tearDown(() async {
if (Invoker.current!.liveTest.errors.isNotEmpty) {
print(await container.allLogs());
}
container.destroy();
});
presets(
'server',
'dashboard',
(final preset) {
late DockerContainer container;
late NextcloudClient client;
setUp(() async {
container = await DockerContainer.create(preset);
client = await TestNextcloudClient.create(container);
});
tearDown(() async {
if (Invoker.current!.liveTest.errors.isNotEmpty) {
print(await container.allLogs());
}
container.destroy();
});

test('Get widgets', () async {
final response = await client.dashboard.dashboardApi.getWidgets();
expect(
response.body.ocs.data.keys,
equals(['activity', 'notes', 'recommendations', 'spreed', 'user_status']),
);
});
test('Get widgets', () async {
final response = await client.dashboard.dashboardApi.getWidgets();
expect(
response.body.ocs.data.keys,
equals(['activity', 'notes', 'recommendations', 'spreed', 'user_status']),
);
});

group('Get widget items', () {
test('v1', () async {
final response = await client.dashboard.dashboardApi.getWidgetItems();
final items = response.body.ocs.data;
expect(items.keys, equals(['recommendations', 'spreed']));
expect(items['recommendations'], hasLength(7));
expect(items['spreed'], hasLength(0));
});

test(
'v2',
() async {
final response = await client.dashboard.dashboardApi.getWidgetItemsV2();
expect(response.body.ocs.data.keys, equals(['recommendations']));
final items = response.body.ocs.data['recommendations']!.items;
expect(items, hasLength(7));
},
skip: preset.version.toVersion() < Version(27, 1, 0),
);
group('Get widget items', () {
test('v1', () async {
final response = await client.dashboard.dashboardApi.getWidgetItems();
final items = response.body.ocs.data;
expect(items.keys, equals(['recommendations', 'spreed']));
expect(items['recommendations'], hasLength(7));
expect(items['spreed'], hasLength(0));
});
},
retry: retryCount,
timeout: timeout,
);
});

test(
'v2',
() async {
final response = await client.dashboard.dashboardApi.getWidgetItemsV2();
expect(response.body.ocs.data.keys, equals(['recommendations']));
final items = response.body.ocs.data['recommendations']!.items;
expect(items, hasLength(7));
},
skip: preset.version.toVersion() < Version(27, 1, 0),
);
});
},
retry: retryCount,
timeout: timeout,
);
}
Loading

0 comments on commit f181bda

Please sign in to comment.