From 1ad67dbe5951537582825539164d26062633fb7b Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Fri, 8 May 2026 14:43:31 -0400 Subject: [PATCH] fix(flutter/test): tolerate Riverpod 3's ProviderException wrapper --- .../test/player/player_provider_test.dart | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/flutter_client/test/player/player_provider_test.dart b/flutter_client/test/player/player_provider_test.dart index be31d391..5ba00e0d 100644 --- a/flutter_client/test/player/player_provider_test.dart +++ b/flutter_client/test/player/player_provider_test.dart @@ -14,7 +14,19 @@ void main() { test('audioHandlerProvider must be overridden — bare read throws', () { final container = ProviderContainer(); addTearDown(container.dispose); - expect(() => container.read(audioHandlerProvider), throwsA(isA())); + // Riverpod 3 wraps the underlying error in a ProviderException. The + // intent of the test is "bare read fails," so accept the wrapper as + // long as the inner error is the UnimplementedError we threw. + expect( + () => container.read(audioHandlerProvider), + throwsA(predicate((e) { + if (e is UnimplementedError) return true; + // ProviderException is private to riverpod; match by name + by + // walking its toString for the inner UnimplementedError text. + return e.runtimeType.toString().contains('ProviderException') && + e.toString().contains('UnimplementedError'); + })), + ); }); test('overridden audioHandlerProvider exposes playbackState stream', () {