mirror of
https://github.com/mainflux/mainflux.git
synced 2025-05-04 22:17:59 +08:00

* MF-325 - Add SPDX license and copyright headers Signed-off-by: Ivan Milošević <iva@blokovi.com> * MF-325 - Add SPDX license and copyright headers Signed-off-by: Ivan Milošević <iva@blokovi.com> * MF-325 - Add SPDX license and copyright headers Signed-off-by: Ivan Milošević <iva@blokovi.com> * MF-325 - Add SPDX license and copyright headers Signed-off-by: Ivan Milošević <iva@blokovi.com> * MF-325 - Change mainflux version from 0.4.0 to 0.5.0 Signed-off-by: Ivan Milošević <iva@blokovi.com>
67 lines
2.0 KiB
TypeScript
67 lines
2.0 KiB
TypeScript
/*
|
|
* Copyright (c) 2018
|
|
* Mainflux
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import { HttpClientModule } from '@angular/common/http';
|
|
import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing';
|
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
|
import { RouterTestingModule } from '@angular/router/testing';
|
|
|
|
import { MaterialModule } from '../../../core/material/material.module';
|
|
import { AuthenticationService } from '../../../core/services/auth/authentication.service';
|
|
import { TokenStorage } from '../../../core/services/auth/token-storage.service';
|
|
import { LoginComponent } from './login.component';
|
|
import { UiStore } from '../../../core/store/ui.store';
|
|
import { AuthStore } from '../../../core/store/auth.store';
|
|
|
|
describe('LoginComponent', () => {
|
|
let component: LoginComponent;
|
|
let fixture: ComponentFixture<LoginComponent>;
|
|
|
|
beforeEach(async(() => {
|
|
TestBed.configureTestingModule({
|
|
declarations: [ LoginComponent ],
|
|
imports: [
|
|
MaterialModule,
|
|
HttpClientModule,
|
|
RouterTestingModule,
|
|
FormsModule,
|
|
ReactiveFormsModule,
|
|
NoopAnimationsModule
|
|
],
|
|
providers: [
|
|
UiStore,
|
|
AuthStore,
|
|
AuthenticationService,
|
|
TokenStorage,
|
|
]
|
|
})
|
|
.compileComponents();
|
|
}));
|
|
|
|
beforeEach(() => {
|
|
fixture = TestBed.createComponent(LoginComponent);
|
|
component = fixture.componentInstance;
|
|
fixture.detectChanges();
|
|
});
|
|
|
|
it('should create', () => {
|
|
expect(component).toBeTruthy();
|
|
});
|
|
|
|
it('should call the store goToSignup when clicked on Sign Up with Email', inject([UiStore], (store: UiStore) => {
|
|
const signupButton = fixture.debugElement.nativeElement.querySelector('.signupButton');
|
|
const signupSpy = spyOn(store, 'goToSignup').and.stub();
|
|
|
|
signupButton.click();
|
|
|
|
fixture.detectChanges();
|
|
|
|
expect(signupSpy).toHaveBeenCalled();
|
|
}));
|
|
});
|