feat: add the app

This commit is contained in:
Jovan Krunić
2018-12-11 22:11:50 +01:00
parent b4268b236f
commit 8b23159e67
129 changed files with 16359 additions and 1 deletions

View File

@@ -0,0 +1,73 @@
/*
* Copyright (C) 2018 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core';
import {async, TestBed} 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';
import {AppComponent} from './app.component';
import {SettingsProvider} from './modules/settingsProvider/settings.provider';
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>;
let settingsProvider: jasmine.SpyObj<SettingsProvider>;
beforeEach(async(() => {
statusBarSpy = jasmine.createSpyObj('StatusBar', ['styleDefault']);
splashScreenSpy = jasmine.createSpyObj('SplashScreen', ['hide']);
platformReadySpy = Promise.resolve();
platformSpy = jasmine.createSpyObj('Platform', { ready: platformReadySpy });
translateServiceSpy = jasmine.createSpyObj('TranslateService', ['setDefaultLang', 'use']);
settingsProvider = jasmine.createSpyObj('SettingsProvider',
['getSettingValue', 'provideSetting', 'setCategoriesOrder']);
TestBed.configureTestingModule({
declarations: [AppComponent],
providers: [
{provide: StatusBar, useValue: statusBarSpy},
{provide: SplashScreen, useValue: splashScreenSpy},
{provide: Platform, useValue: platformSpy},
{provide: TranslateService, useValue: translateServiceSpy},
{provide: SettingsProvider, useValue: settingsProvider},
],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
}).compileComponents();
}));
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
});
it('should initialize the app', async () => {
TestBed.createComponent(AppComponent);
expect(platformSpy.ready).toHaveBeenCalled();
await platformReadySpy;
expect(statusBarSpy.styleDefault).toHaveBeenCalled();
expect(splashScreenSpy.hide).toHaveBeenCalled();
});
// TODO: add more tests!
});