mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-07 05:52:57 +00:00
@@ -16,8 +16,6 @@
|
||||
import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core';
|
||||
import {TestBed, waitForAsync} from '@angular/core/testing';
|
||||
|
||||
import {SplashScreen} from '@ionic-native/splash-screen/ngx';
|
||||
import {StatusBar} from '@ionic-native/status-bar/ngx';
|
||||
import {Platform} from '@ionic/angular';
|
||||
|
||||
import {TranslateService} from '@ngx-translate/core';
|
||||
@@ -28,8 +26,6 @@ import {SettingsProvider} from './modules/settings/settings.provider';
|
||||
import {NGXLogger} from 'ngx-logger';
|
||||
|
||||
describe('AppComponent', () => {
|
||||
let statusBarSpy: jasmine.SpyObj<StatusBar>;
|
||||
let splashScreenSpy: jasmine.SpyObj<SplashScreen>;
|
||||
let platformReadySpy: any;
|
||||
let platformSpy: jasmine.SpyObj<Platform>;
|
||||
let translateServiceSpy: jasmine.SpyObj<TranslateService>;
|
||||
@@ -40,8 +36,6 @@ describe('AppComponent', () => {
|
||||
|
||||
beforeEach(
|
||||
waitForAsync(() => {
|
||||
statusBarSpy = jasmine.createSpyObj('StatusBar', ['styleDefault']);
|
||||
splashScreenSpy = jasmine.createSpyObj('SplashScreen', ['hide']);
|
||||
platformReadySpy = Promise.resolve();
|
||||
platformSpy = jasmine.createSpyObj('Platform', {ready: platformReadySpy});
|
||||
translateServiceSpy = jasmine.createSpyObj('TranslateService', [
|
||||
@@ -62,8 +56,6 @@ describe('AppComponent', () => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [AppComponent],
|
||||
providers: [
|
||||
{provide: StatusBar, useValue: statusBarSpy},
|
||||
{provide: SplashScreen, useValue: splashScreenSpy},
|
||||
{provide: Platform, useValue: platformSpy},
|
||||
{provide: TranslateService, useValue: translateServiceSpy},
|
||||
{provide: ThingTranslateService, useValue: thingTranslateServiceSpy},
|
||||
@@ -85,9 +77,10 @@ describe('AppComponent', () => {
|
||||
it('should initialize the app', async () => {
|
||||
TestBed.createComponent(AppComponent);
|
||||
expect(platformSpy.ready).toHaveBeenCalled();
|
||||
await platformReadySpy;
|
||||
expect(statusBarSpy.styleDefault).toHaveBeenCalled();
|
||||
expect(splashScreenSpy.hide).toHaveBeenCalled();
|
||||
// await platformReadySpy;
|
||||
|
||||
// TODO: https://capacitorjs.com/docs/guides/mocking-plugins
|
||||
// expect(splashScreenSpy.hide).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
// TODO: add more tests!
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component} from '@angular/core';
|
||||
import {SplashScreen} from '@ionic-native/splash-screen/ngx';
|
||||
import {StatusBar} from '@ionic-native/status-bar/ngx';
|
||||
import {SplashScreen} from '@capacitor/splash-screen';
|
||||
import {Platform} from '@ionic/angular';
|
||||
import {NGXLogger} from 'ngx-logger';
|
||||
import {ConfigProvider} from './modules/config/config.provider';
|
||||
@@ -45,16 +44,12 @@ export class AppComponent {
|
||||
/**
|
||||
*
|
||||
* @param platform TODO
|
||||
* @param statusBar TODO
|
||||
* @param splashScreen TODO
|
||||
* @param settingsProvider TODO
|
||||
* @param configProvider TODO
|
||||
* @param logger An angular logger
|
||||
*/
|
||||
constructor(
|
||||
private readonly platform: Platform,
|
||||
private readonly statusBar: StatusBar,
|
||||
private readonly splashScreen: SplashScreen,
|
||||
private readonly settingsProvider: SettingsProvider,
|
||||
private readonly configProvider: ConfigProvider,
|
||||
private readonly logger: NGXLogger,
|
||||
@@ -67,10 +62,7 @@ export class AppComponent {
|
||||
*/
|
||||
async initializeApp() {
|
||||
this.platform.ready().then(async () => {
|
||||
// Okay, so the platform is ready and our plugins are available.
|
||||
// Here you can do any higher level native things you might need.
|
||||
this.statusBar.styleDefault();
|
||||
this.splashScreen.hide();
|
||||
await SplashScreen.hide();
|
||||
|
||||
// initialise the configProvider
|
||||
try {
|
||||
|
||||
@@ -24,8 +24,6 @@ import {APP_INITIALIZER, NgModule, Provider} from '@angular/core';
|
||||
import {BrowserModule} from '@angular/platform-browser';
|
||||
import {RouteReuseStrategy} from '@angular/router';
|
||||
import {Diagnostic} from '@ionic-native/diagnostic/ngx';
|
||||
import {SplashScreen} from '@ionic-native/splash-screen/ngx';
|
||||
import {StatusBar} from '@ionic-native/status-bar/ngx';
|
||||
import {IonicModule, IonicRouteStrategy} from '@ionic/angular';
|
||||
import {
|
||||
TranslateLoader,
|
||||
@@ -112,8 +110,6 @@ export function createTranslateLoader(http: HttpClient) {
|
||||
}
|
||||
|
||||
const providers: Provider[] = [
|
||||
StatusBar,
|
||||
SplashScreen,
|
||||
Diagnostic,
|
||||
{
|
||||
provide: RouteReuseStrategy,
|
||||
|
||||
Reference in New Issue
Block a user