I am trying to use Testbed in a new Angular 7 / Ionic 4 app but cannot run any tests because my components depend on an Ionic native plugin, storage.
app.com
First, import Storage:
import { Storage } from '@ionic/storage';
Create a const for mock:
const storageIonicMock: any = {
get: () => new Promise((resolve, reject) => resolve('As2342fAfgsdr')),
set: () => ...
};
Configure your TesBed
TestBed.configureTestingModule({
imports: [],
providers: [
{
provide: Storage,
useValue: storageIonicMock
}
]
});