You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FYI.. I mock the platform as true in my mock file. Here I'm getting the platform as cordova.
I'm getting below error when I excute the above test case.
TypeError: undefined is not an object (evaluating 'window['plugins'].appPreferences') in config/karma-shim.js (line 29367)
Can anyone please let me know how to mock this plugin.
My mock file:
export class MockPlatformWithCordova {
public ready(): any {
return new Promise((resolve: Function) => {
resolve();
});
}
public is(name: string){
if (name === 'cordova')
return true;
return true;
}
}
Please specify your environment
Plugin version:
released version: _____
repository master
Toolchain:
Cordova cli
Phonegap cli
Phonegap cloud
Ionic
Other: _____
Platforms affected:
Android
iOS/macOS
LocalStorage fallback for browser and blackberry
Windows and Windows Phone 8.1 and later
Windows Phone 8 and earlier (deprecated)
What the scope of your problem:
General functionality (store/fetch/remove/clearAll)
Suites
Cloud synchronization and events
Preferences pane generation and display
The text was updated successfully, but these errors were encountered:
Issue:
I need to write test cases for this plugin in my project. Below is the way I tried in my project but I'm getting the error.
ts file:
save(){
if (this.platform.is('cordova')){
var prefs = window['plugins'].appPreferences;
prefs.store (null, this.onPrefStoreError, 'serverUrl', this._settings.serverUrl);
prefs.store (null, this.onPrefStoreError, 'useProxy', this._settings.useProxy);
}
localStorage['settings'] = JSON.stringify(this._settings);
console.log('saved settings');
}
Spec file:
it('call save', inject([SettingsService,Platform], (settingsService: SettingsService, platform: Platform) => {
settingsService.save();
});
});
FYI.. I mock the platform as true in my mock file. Here I'm getting the platform as cordova.
I'm getting below error when I excute the above test case.
TypeError: undefined is not an object (evaluating 'window['plugins'].appPreferences') in config/karma-shim.js (line 29367)
Can anyone please let me know how to mock this plugin.
My mock file:
export class MockPlatformWithCordova {
public ready(): any {
return new Promise((resolve: Function) => {
resolve();
});
}
}
Please specify your environment
Plugin version:
Toolchain:
Platforms affected:
What the scope of your problem:
The text was updated successfully, but these errors were encountered: