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

Invalid argument(s): The "any" argument matcher is used outside of method stubbing (via when) or verification (via verify or untilCalled). This is invalid, and results in bad behavior during the next stubbing or verification. #163

Open
raxahai opened this issue Nov 5, 2022 · 1 comment
Labels
question Further information is requested waiting for response Waiting for follow up

Comments

@raxahai
Copy link

raxahai commented Nov 5, 2022

class FakeRequest extends Fake implements RequestOptions{}

setUp((){
registerCallback(FakeRequest())
});

test("should fetch customer info", () async {
    // arrange
    when(() => mockDioClient.get(any())).thenAnswer(
      (_) async => Response(
        data: fixture("customer_fixture.json"),
        requestOptions: any(),
        statusCode: 200,
      ),
    );

    // act
    var result = await profileRemoteDataSourceImpl.getCustomerInfo();

    // assert
    expect(result, testCustomerModel);
    verify(() => mockDioClient.get(Urls.getCustomerInfo));
    verifyNoMoreInteractions(mockDioClient);
  });
@felangel
Copy link
Owner

Hi @raxahai 👋
Thanks for opening an issue! If you're still having trouble with this can you please share a link to a minimal reproduction sample? It's much easier for me to help if I'm able to reproduce the issue locally, thanks!

@felangel felangel added question Further information is requested waiting for response Waiting for follow up labels Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested waiting for response Waiting for follow up
Projects
None yet
Development

No branches or pull requests

2 participants