MethodChannel to mock ResultType.noAppToOpen in test
See original GitHub issueHello,
Currently I am trying to mock the ResultType.noAppToOpen in the test as shown below.
So I did the method channel below.
const MethodChannel('open_file').setMockMethodCallHandler(methodCall) { return OpenResult(message: 'No APP found to open this file.' , type: ResultType.noAppToOpen);
But I am unable to have the desired return of ResultType.noAppToOpen
in my test.
Am I doing the methodChannel wrongly for this since there is filePath inside OpenFile.open(filePath)
? Or is the methodChannel not working for this. Thank you.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:11
Top Results From Across the Web
dart - MethodChannel to mock OpenFile package in flutter for ...
Currently I am trying to mock the package of OpenFile in Flutter for ResultType.noAppToOpen in the test here. So I did the method...
Read more >[integration_test] Mocking method channels with dynamic ...
We are testing our app with integrationtests. At one point we mock method channel with of a plugin. In the method channel name...
Read more >Transition of platform channel test interfaces to flutter_test ...
The setMockMessageHandler method related APIs have moved from package:flutter to package:flutter_test.
Read more >platform_channel_test.dart - Google Git
const MethodChannel channel = MethodChannel('ch7', jsonMethod);. test('can invoke method and get result', () async {. BinaryMessages.setMockMessageHandler(.
Read more >channel_mock | Flutter Package - Pub.dev
A package to help mock communications channels in Flutter to make unit testing and mocking flutter plugins easier.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
just make another wrapper service and mock it, that would work regardless of how this library is written. I did this in my case
Or and idea would be to not use static methods anymore as they are not mockable, you could do something like that:
And instead of do
it will be