I am writing unit test cases for Android and I am using functions like :
@PluginMethod
public void lock(PluginCall call) {
call.resolve();
}
I am not able to find out how I can Mock PluginCall class so that I can pass and return data from it. Any help?
here will be the documentation of Mocking Capacitor Plugin
Hi, i am using Jest for unit test. The way i mock a plugin call will be something like:
StatusBar.setBackgroundColor = jest.fn().mockReturnValue(Promise.resolve());
after created a __mocks__/@capacitor
folder at the root of my project.
Hope this helped.
sorry, I misunderstanding your question. You mean for for native android ? Creating unit tests for capacitor native android plugin - Stack Overflow <-I found a related link here.
Thanks for the answering. But there is no solution provided on the link you shared.