Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FakeAsync is passing a test after throw UnimplementedError #715

Open
omensight opened this issue Dec 13, 2022 · 1 comment
Open

FakeAsync is passing a test after throw UnimplementedError #715

omensight opened this issue Dec 13, 2022 · 1 comment

Comments

@omensight
Copy link

omensight commented Dec 13, 2022

Hello, this is my test.

test('Join assembly post a join request in server', () {                            
  FakeAsync().run((async) async {                                                   
    final membersDao = MockAssemblyMembersDao();                                    
    final membersApiClient = MockAssemblyMembersApiClient();                        
    final assemblyRequestDao = MockAssemblyJoin RequestsDao();                      
    final userDao = MockUserDao();                                                  
    when(() => membersApiClient.postJoinRequest(any())).thenAnswer(                 
      (invocation) => Future(                                                       
        () => HttpResponse(                                                         
          '',                                                                       
          Response(                                                                 
            requestOptions: RequestOptions(                                         
              path: '',                                                             
            ), // RequestOptions                                                    
            statusCode: 201), // Response                                           
        ), // HttpResponse                                                          
      ), // Future                                                                  
    );                                                                              
    final membersRepository = AssemblyMembersRepository(                            
      assemblyMembersDao: membersDao,                                               
      assemblyMembersApiClient: membersApiClient,                                   
      assemblyJoinRequestsDao: assemblyRequestDao,                                  
      userDao: userDao);                                                            
    var result = await membersRepository.postJoinRequest('uuid');                   
    expect(result, isA>());                                                         
  });                                                                               
);

And this is the not yet implemented method:

Future<Either<RestFailure, Assembly>> postJoinRequest(String uuidCode) async {
  throw UnimplementedError();
}

The test unexpectedly pass instead to show me an error and mark itself red.
image

@cbracken
Copy link
Member

cbracken commented Dec 13, 2022

@omensight in order to investigate this, we'll need a reduced repro that can be run without the rest of your codebase. Can you please replace the code above with a minimal repro? Please attach actual code snippets, as opposed to screenshots. I've replaced the screenshots that were attached to the original issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants