From 1b49cf3348741acfb12518e28bd9285e2db81cda Mon Sep 17 00:00:00 2001 From: provokateurin Date: Tue, 13 Feb 2024 20:38:07 +0100 Subject: [PATCH] refactor: Stop using toBuilder() Signed-off-by: provokateurin --- packages/neon/neon_dashboard/test/widget_test.dart | 9 ++++----- packages/neon_framework/test/dialog_test.dart | 8 ++++---- .../neon_framework/test/weather_status_bloc_test.dart | 8 ++++---- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/packages/neon/neon_dashboard/test/widget_test.dart b/packages/neon/neon_dashboard/test/widget_test.dart index 6863147e4a7..52939437f2e 100644 --- a/packages/neon/neon_dashboard/test/widget_test.dart +++ b/packages/neon/neon_dashboard/test/widget_test.dart @@ -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'; @@ -236,7 +235,7 @@ void main() { ); final items = dashboard.WidgetItems( (b) => b - ..items = BuiltList.from([item]).toBuilder() + ..items.replace([item]) ..emptyContentMessage = '' ..halfEmptyContentMessage = '', ); @@ -255,9 +254,9 @@ void main() { ..iconUrl = 'https://example.com/iconUrl' ..widgetUrl = 'https://example.com/widgetUrl' ..itemIconsRound = true - ..itemApiVersions = BuiltList.from([1, 2]).toBuilder() + ..itemApiVersions.replace([1, 2]) ..reloadInterval = 0 - ..buttons = BuiltList.from([button]).toBuilder(), + ..buttons.replace([button]), ); testWidgets('Everything filled', (tester) async { @@ -457,7 +456,7 @@ void main() { testWidgets('With multiple buttons', (tester) async { final widgetWithMultipleButtons = widget.rebuild( - (b) => b.buttons = BuiltList.from([button, button]).toBuilder(), + (b) => b.buttons.replace([button, button]), ); await tester.pumpWidget( wrapWidget( diff --git a/packages/neon_framework/test/dialog_test.dart b/packages/neon_framework/test/dialog_test.dart index 9f6aada21c4..eea3a50eaf0 100644 --- a/packages/neon_framework/test/dialog_test.dart +++ b/packages/neon_framework/test/dialog_test.dart @@ -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(), + ), ), ]), ), diff --git a/packages/neon_framework/test/weather_status_bloc_test.dart b/packages/neon_framework/test/weather_status_bloc_test.dart index e10c54e8a88..8f03c6126c2 100644 --- a/packages/neon_framework/test/weather_status_bloc_test.dart +++ b/packages/neon_framework/test/weather_status_bloc_test.dart @@ -97,7 +97,7 @@ 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 @@ -105,7 +105,7 @@ core.OcsGetCapabilitiesResponseApplicationJson_Ocs_Data buildCapabilities({requi ..string = '' ..edition = '' ..extendedSupport = false, - ).toBuilder() + ) ..capabilities = ( commentsCapabilities: null, davCapabilities: null, @@ -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(), + ), ), ), );