import 'package:flutter_test/flutter_test.dart'; import 'package:tasq/utils/snackbar.dart'; void main() { test('strips exception dumps down to the message', () { expect( humanizeErrorText( 'Sign in failed: AuthApiException(message: Invalid login credentials, ' 'statusCode: 400, code: invalid_credentials)', ), 'Sign in failed: Invalid login credentials', ); expect( humanizeErrorText( 'Error: PostgrestException(message: Could not find f(a, b) in the ' 'schema cache, code: PGRST202, details: x, hint: y)', ), 'Error: Could not find f(a, b) in the schema cache', ); expect( humanizeErrorText('Error: Exception: Not authenticated'), 'Error: Not authenticated', ); }); test('leaves plain messages alone', () { expect( humanizeErrorText('Event name is required'), 'Event name is required', ); }); }