Skip to content

Commit

Permalink
Merge pull request #1597 from nextcloud/refactor/stop-using-tobuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
provokateurin authored Feb 13, 2024
2 parents 5211be3 + 1b49cf3 commit 19e5c95
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
9 changes: 4 additions & 5 deletions packages/neon/neon_dashboard/test/widget_test.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:built_collection/built_collection.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mocktail/mocktail.dart';
Expand Down Expand Up @@ -236,7 +235,7 @@ void main() {
);
final items = dashboard.WidgetItems(
(b) => b
..items = BuiltList<dashboard.WidgetItem>.from([item]).toBuilder()
..items.replace([item])
..emptyContentMessage = ''
..halfEmptyContentMessage = '',
);
Expand All @@ -255,9 +254,9 @@ void main() {
..iconUrl = 'https://example.com/iconUrl'
..widgetUrl = 'https://example.com/widgetUrl'
..itemIconsRound = true
..itemApiVersions = BuiltList<int>.from([1, 2]).toBuilder()
..itemApiVersions.replace([1, 2])
..reloadInterval = 0
..buttons = BuiltList<dashboard.Widget_Buttons>.from([button]).toBuilder(),
..buttons.replace([button]),
);

testWidgets('Everything filled', (tester) async {
Expand Down Expand Up @@ -457,7 +456,7 @@ void main() {

testWidgets('With multiple buttons', (tester) async {
final widgetWithMultipleButtons = widget.rebuild(
(b) => b.buttons = BuiltList<dashboard.Widget_Buttons>.from([button, button]).toBuilder(),
(b) => b.buttons.replace([button, button]),
);
await tester.pumpWidget(
wrapWidget(
Expand Down
8 changes: 4 additions & 4 deletions packages/neon_framework/test/dialog_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -232,28 +232,28 @@ void main() {
..id = 'id1'
..icon = '😁'
..message = 'message1'
..clearAt = user_status.ClearAt(
..clearAt.update(
(b) => b
..type = user_status.ClearAt_Type.period
..time = (
$int: 60 * 60 * 7,
clearAtTimeType: null,
),
).toBuilder(),
),
),
user_status.Predefined(
(b) => b
..id = 'id2'
..icon = '😆'
..message = 'message2'
..clearAt = user_status.ClearAt(
..clearAt.update(
(b) => b
..type = user_status.ClearAt_Type.endOf
..time = (
$int: null,
clearAtTimeType: user_status.ClearAtTimeType.week,
),
).toBuilder(),
),
),
]),
),
Expand Down
8 changes: 4 additions & 4 deletions packages/neon_framework/test/weather_status_bloc_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ Account mockWeatherStatusAccount() {
core.OcsGetCapabilitiesResponseApplicationJson_Ocs_Data buildCapabilities({required bool enabled}) =>
core.OcsGetCapabilitiesResponseApplicationJson_Ocs_Data(
(b) => b
..version = core.OcsGetCapabilitiesResponseApplicationJson_Ocs_Data_Version(
..version.update(
(b) => b
..major = 0
..minor = 0
..micro = 0
..string = ''
..edition = ''
..extendedSupport = false,
).toBuilder()
)
..capabilities = (
commentsCapabilities: null,
davCapabilities: null,
Expand All @@ -122,9 +122,9 @@ core.OcsGetCapabilitiesResponseApplicationJson_Ocs_Data buildCapabilities({requi
userStatusCapabilities: null,
weatherStatusCapabilities: core.WeatherStatusCapabilities(
(b) => b
..weatherStatus = core.WeatherStatusCapabilities_WeatherStatus(
..weatherStatus.update(
(b) => b..enabled = enabled,
).toBuilder(),
),
),
),
);
Expand Down

0 comments on commit 19e5c95

Please sign in to comment.