You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected: should emit an error that <Instance of 'ServerException'> with message: contains 'Test error' and statusCode: 'test_error' Actual: <Closure: () => Stream<List<HelpResponseModel>>> Which: was not a Stream or a StreamQueue
The text was updated successfully, but these errors were encountered:
i have this method
ResultStream<List<HelpResponse>> getResponses({required String requestId}) {
return _remoteDataSource
.getResponses(requestId)
.map<EitherResult<List<HelpResponse>>>((response) {
try {
final helpResponses =
response.map((model) => model as HelpResponse).toList();
return Right(helpResponses);
} catch (e) {
return Left(
ServerFailure(
message: 'Error processing response: $e',
statusCode: 1507,
),
);
}
}).handleError((Object error) {
if (error is FirebaseException) {
return Left<Failure, dynamic>(
ServerFailure(
message: error.toString(),
statusCode: 501,
),
);
}
return Left<Failure, dynamic>(
ServerFailure(
message: 'Unknown error occurred',
statusCode: 500,
),
);
});
}
and this is my test
test('getRequests handles errors [FirebaseException]', () async {
final collection = mockFirebaseFirestore.collection('responses');
whenCalling(Invocation.method(#snapshots, null))
.on(collection)
.thenThrow(FirebaseException(
plugin: 'cloud_firestore',
message: 'Test error',
code: 'test_error',
));
// final stream = dataSource.getResponses(requestId);
expect(
() => dataSource.getResponses(requestId),
emitsError(
isA<ServerException>()
.having((e) => e.message, 'message', contains('Test error'))
.having((e) => e.statusCode, 'statusCode', 501),
),
);
});
});
but i am getting this error
Expected: should emit an error that <Instance of 'ServerException'> with
message: contains 'Test error' and statusCode:
'test_error'
Actual: <Closure: () => Stream<List<HelpResponseModel>>>
Which: was not a Stream or a StreamQueue
The text was updated successfully, but these errors were encountered: