MOBILE-3320 tests: Fix tests
parent
d94630ce61
commit
3996880ab7
|
@ -12,22 +12,27 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import { NavController } from '@ionic/angular';
|
||||
|
||||
import { AppComponent } from '@app/app.component';
|
||||
import { CoreEvents } from '@singletons/events';
|
||||
import { CoreLangProvider } from '@services/lang';
|
||||
|
||||
import { mock, renderComponent, RenderConfig } from '@/tests/utils';
|
||||
|
||||
describe('App component', () => {
|
||||
describe('AppComponent', () => {
|
||||
|
||||
let langProvider: CoreLangProvider;
|
||||
let navController: NavController;
|
||||
let config: Partial<RenderConfig>;
|
||||
|
||||
beforeEach(() => {
|
||||
langProvider = mock<CoreLangProvider>(['clearCustomStrings']);
|
||||
navController = mock<NavController>(['navigateRoot']);
|
||||
config = {
|
||||
providers: [
|
||||
{ provide: CoreLangProvider, useValue: langProvider },
|
||||
{ provide: NavController, useValue: navController },
|
||||
],
|
||||
};
|
||||
});
|
||||
|
@ -39,13 +44,14 @@ describe('App component', () => {
|
|||
expect(fixture.nativeElement.querySelector('ion-router-outlet')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('clears custom strings on logout', async () => {
|
||||
it('cleans up on logout', async () => {
|
||||
const fixture = await renderComponent(AppComponent, config);
|
||||
|
||||
fixture.componentInstance.ngOnInit();
|
||||
CoreEvents.trigger(CoreEvents.LOGOUT);
|
||||
|
||||
expect(langProvider.clearCustomStrings).toHaveBeenCalled();
|
||||
expect(navController.navigateRoot).toHaveBeenCalledWith('/login/sites');
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -16,7 +16,7 @@ import { CoreIconComponent } from '@components/icon/icon';
|
|||
|
||||
import { renderWrapperComponent } from '@/tests/utils';
|
||||
|
||||
describe('CoreIcon', () => {
|
||||
describe('CoreIconComponent', () => {
|
||||
|
||||
it('should render', async () => {
|
||||
// Act
|
||||
|
|
|
@ -17,19 +17,21 @@ import { NavController } from '@ionic/angular';
|
|||
import { CoreApp } from '@/app/services/app';
|
||||
import { CoreInit } from '@services/init';
|
||||
import { CoreLoginInitPage } from '@core/login/pages/init/init.page';
|
||||
import { CoreSites } from '@/app/services/sites';
|
||||
import { SplashScreen } from '@/app/singletons/core.singletons';
|
||||
|
||||
import { mock, mockSingleton, renderComponent, RenderConfig } from '@/tests/utils';
|
||||
|
||||
describe('CoreLogin Init Page', () => {
|
||||
describe('CoreLoginInitPage', () => {
|
||||
|
||||
let navController: NavController;
|
||||
let config: Partial<RenderConfig>;
|
||||
|
||||
beforeEach(() => {
|
||||
mockSingleton(SplashScreen, ['hide']);
|
||||
mockSingleton(CoreInit, { ready: () => Promise.resolve() });
|
||||
mockSingleton(CoreApp, { getRedirect: () => ({}) });
|
||||
mockSingleton(CoreInit, { ready: () => Promise.resolve() });
|
||||
mockSingleton(CoreSites, { isLoggedIn: () => false });
|
||||
mockSingleton(SplashScreen, ['hide']);
|
||||
|
||||
navController = mock<NavController>(['navigateRoot']);
|
||||
config = {
|
||||
|
|
Loading…
Reference in New Issue