ng test 관련 소스 수정본. 컴포넌트 관련은 미완료.
This commit is contained in:
@@ -1,6 +1,23 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ChangePasswordComponent } from './change-password.component';
|
||||
import { AuthenticationUiModule } from '../authentication-ui.module';
|
||||
import { FormBuilder, ReactiveFormsModule } from '@angular/forms';
|
||||
import { ChangeDetectorRef } from '@angular/core';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { I18nService, UCAP_I18N_NAMESPACE, I18nModule } from '@ucap/ng-i18n';
|
||||
import { LogService } from '@ucap/logger';
|
||||
import { FlexLayoutModule } from '@angular/flex-layout';
|
||||
import { UiModule } from '@ucap/ng-ui';
|
||||
|
||||
describe('Account::ChangePasswordComponent', () => {
|
||||
let component: ChangePasswordComponent;
|
||||
@@ -8,7 +25,33 @@ describe('Account::ChangePasswordComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ChangePasswordComponent]
|
||||
imports: [
|
||||
BrowserModule,
|
||||
BrowserAnimationsModule,
|
||||
|
||||
CommonModule,
|
||||
ReactiveFormsModule,
|
||||
|
||||
FlexLayoutModule,
|
||||
|
||||
MatButtonModule,
|
||||
MatCheckboxModule,
|
||||
MatFormFieldModule,
|
||||
MatIconModule,
|
||||
MatInputModule,
|
||||
MatProgressSpinnerModule,
|
||||
MatSelectModule
|
||||
],
|
||||
declarations: [
|
||||
AuthenticationUiModule,
|
||||
// { provide: FormBuilder, useValue: new FormBuilder() },
|
||||
// { provide: ChangeDetectorRef, useValue: ChangeDetectorRef },
|
||||
{ provide: I18nService, useValue: new I18nService(new LogService({})) },
|
||||
{
|
||||
provide: UCAP_I18N_NAMESPACE,
|
||||
useValue: 'authentication'
|
||||
}
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
@@ -18,7 +61,30 @@ describe('Account::ChangePasswordComponent', () => {
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
// it('should create', () => {
|
||||
// // component.loginId = 'test03';
|
||||
// // component.phoneNumber = '01011112222';
|
||||
// // // component.encryptedLoginPw = 'encpw';
|
||||
// // fixture.detectChanges();
|
||||
|
||||
// // component.ngOnInit();
|
||||
|
||||
// expect(component).toBeTruthy();
|
||||
// });
|
||||
|
||||
// it('click changePassword', (done) => {
|
||||
// component.loginId = 'test03';
|
||||
// component.phoneNumber = '01011112222';
|
||||
// // component.encryptedLoginPw = 'encpw';
|
||||
// fixture.detectChanges();
|
||||
|
||||
// component.ngOnInit();
|
||||
|
||||
// component.changePassword.subscribe((value) => {
|
||||
// console.log(value);
|
||||
// done();
|
||||
// });
|
||||
|
||||
// component.onClickChangePassword();
|
||||
// });
|
||||
});
|
||||
|
||||
@@ -1,6 +1,22 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { LoginComponent } from './login.component';
|
||||
import { FormBuilder, ReactiveFormsModule } from '@angular/forms';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { ChangeDetectorRef } from '@angular/core';
|
||||
import { I18nService, UCAP_I18N_NAMESPACE } from '@ucap/ng-i18n';
|
||||
import { AuthenticationUiModule } from '../authentication-ui.module';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { Company } from '@ucap/api-external';
|
||||
import { LogService } from '@ucap/ng-logger';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
|
||||
describe('ui::authentication::LoginComponent', () => {
|
||||
let component: LoginComponent;
|
||||
@@ -8,7 +24,31 @@ describe('ui::authentication::LoginComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [LoginComponent]
|
||||
imports: [
|
||||
BrowserModule,
|
||||
BrowserAnimationsModule,
|
||||
|
||||
CommonModule,
|
||||
ReactiveFormsModule,
|
||||
|
||||
MatButtonModule,
|
||||
MatCheckboxModule,
|
||||
MatFormFieldModule,
|
||||
MatIconModule,
|
||||
MatInputModule,
|
||||
MatProgressSpinnerModule,
|
||||
MatSelectModule
|
||||
],
|
||||
providers: [
|
||||
AuthenticationUiModule,
|
||||
// { provide: FormBuilder, useValue: new FormBuilder() },
|
||||
// { provide: ChangeDetectorRef, useValue: ChangeDetectorRef },
|
||||
{ provide: I18nService, useValue: new I18nService(new LogService({})) },
|
||||
{
|
||||
provide: UCAP_I18N_NAMESPACE,
|
||||
useValue: 'authentication'
|
||||
}
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
@@ -19,6 +59,34 @@ describe('ui::authentication::LoginComponent', () => {
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
component.companyList = [
|
||||
{ companyName: 'LG CNS', companyCode: 'GUC100' },
|
||||
{ companyName: 'LG UCAP', companyCode: 'GUC101' }
|
||||
] as Company[];
|
||||
component.loginId = 'test';
|
||||
component.companyCode = 'GUC100';
|
||||
fixture.detectChanges();
|
||||
|
||||
component.ngOnInit();
|
||||
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
|
||||
it('login', (done) => {
|
||||
component.companyList = [
|
||||
{ companyName: 'LG CNS', companyCode: 'GUC100' },
|
||||
{ companyName: 'LG UCAP', companyCode: 'GUC101' }
|
||||
] as Company[];
|
||||
component.loginId = 'test';
|
||||
component.companyCode = 'GUC100';
|
||||
|
||||
component.ngOnInit();
|
||||
|
||||
component.login.subscribe((value) => {
|
||||
console.log(value);
|
||||
done();
|
||||
});
|
||||
|
||||
component.onClickLogin();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user