ng test 관련 소스 수정본. 컴포넌트 관련은 미완료.
This commit is contained in:
parent
1bfffe2a7d
commit
9fe4faad43
21
package-lock.json
generated
21
package-lock.json
generated
|
@ -2410,7 +2410,8 @@
|
||||||
},
|
},
|
||||||
"@ucap/ng-web-socket": {
|
"@ucap/ng-web-socket": {
|
||||||
"version": "file:pack/ucap-ng-web-socket-0.0.2.tgz",
|
"version": "file:pack/ucap-ng-web-socket-0.0.2.tgz",
|
||||||
"integrity": "sha512-hMn8niCiRfR3ZUzE0oqspJGlGl0DKvLizkVMphF+JenqwARQcBYR+G7e+4HPEGyRbu0LtimkhMfExzJFTHky3A=="
|
"integrity": "sha512-hMn8niCiRfR3ZUzE0oqspJGlGl0DKvLizkVMphF+JenqwARQcBYR+G7e+4HPEGyRbu0LtimkhMfExzJFTHky3A==",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"@ucap/ng-web-storage": {
|
"@ucap/ng-web-storage": {
|
||||||
"version": "file:pack/ucap-ng-web-storage-0.0.3.tgz",
|
"version": "file:pack/ucap-ng-web-storage-0.0.3.tgz",
|
||||||
|
@ -2423,6 +2424,12 @@
|
||||||
"integrity": "sha512-nWev387pHxeBHtOu0EvRTVQ0/JeJL44Ew0PzQaiqHsC5mghkJ6ok7z22nk9nmuZ7lONxGJmW7CHT8X8lyviZJg==",
|
"integrity": "sha512-nWev387pHxeBHtOu0EvRTVQ0/JeJL44Ew0PzQaiqHsC5mghkJ6ok7z22nk9nmuZ7lONxGJmW7CHT8X8lyviZJg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"@ucap/protocol": {
|
||||||
|
"version": "0.0.11",
|
||||||
|
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/protocol/-/protocol-0.0.11.tgz",
|
||||||
|
"integrity": "sha512-nmwejglPVtC7elUn8x05ENFyqFz0z2pFibpblqAUW3m8HQHBSIKLqfctVsHzk5iP9/JyCDCTDuJ2DjMhMVJB8g==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"@ucap/protocol-authentication": {
|
"@ucap/protocol-authentication": {
|
||||||
"version": "0.0.5",
|
"version": "0.0.5",
|
||||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/protocol-authentication/-/protocol-authentication-0.0.5.tgz",
|
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/@ucap/protocol-authentication/-/protocol-authentication-0.0.5.tgz",
|
||||||
|
@ -4945,6 +4952,12 @@
|
||||||
"randomfill": "^1.0.3"
|
"randomfill": "^1.0.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"crypto-js": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/crypto-js/-/crypto-js-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-bzHZN8Pn+gS7DQA6n+iUmBfl0hO5DJq++QP3U6uTucDtk/0iGpXd/Gg7CGR0p8tJhofJyaKoWBuJI4eAO00BBg==",
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
"crypto-random-string": {
|
"crypto-random-string": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/crypto-random-string/-/crypto-random-string-2.0.0.tgz",
|
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/crypto-random-string/-/crypto-random-string-2.0.0.tgz",
|
||||||
|
@ -11516,6 +11529,12 @@
|
||||||
"integrity": "sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA==",
|
"integrity": "sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"queueing-subject": {
|
||||||
|
"version": "0.3.4",
|
||||||
|
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/queueing-subject/-/queueing-subject-0.3.4.tgz",
|
||||||
|
"integrity": "sha512-sdpymi9eq80oZyg74NrIGr1GHKIDRmBLZp+xqOct8Do5KpKalPsSz9NxApZb0S2j+EEDMzDlosBN5NJGFLmS7A==",
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
"quick-lru": {
|
"quick-lru": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/quick-lru/-/quick-lru-1.1.0.tgz",
|
"resolved": "http://10.81.13.221:8081/nexus/repository/npm-all/quick-lru/-/quick-lru-1.1.0.tgz",
|
||||||
|
|
|
@ -225,5 +225,9 @@
|
||||||
"typescript": "~3.7.5",
|
"typescript": "~3.7.5",
|
||||||
"webpack-bundle-analyzer": "^3.6.1",
|
"webpack-bundle-analyzer": "^3.6.1",
|
||||||
"zone.js": "~0.10.2"
|
"zone.js": "~0.10.2"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"queueing-subject": "^0.3.4",
|
||||||
|
"crypto-js": "^4.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,23 @@
|
||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
import { CommonApiService } from './common-api.service';
|
import { CommonApiService } from './common-api.service';
|
||||||
|
import { AXIOS_INSTANCE } from '@ucap/ng-core';
|
||||||
|
import { _MODULE_CONFIG } from '../config/token';
|
||||||
|
|
||||||
describe('CommonApiService', () => {
|
describe('CommonApiService', () => {
|
||||||
beforeEach(() => TestBed.configureTestingModule({}));
|
let service: CommonApiService;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
providers: [
|
||||||
|
{ provide: _MODULE_CONFIG, useValue: _MODULE_CONFIG },
|
||||||
|
{ provide: AXIOS_INSTANCE, useValue: AXIOS_INSTANCE }
|
||||||
|
]
|
||||||
|
});
|
||||||
|
service = TestBed.inject(CommonApiService);
|
||||||
|
});
|
||||||
|
|
||||||
it('should be created', () => {
|
it('should be created', () => {
|
||||||
const service: CommonApiService = TestBed.inject(CommonApiService);
|
|
||||||
expect(service).toBeTruthy();
|
expect(service).toBeTruthy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,12 +1,23 @@
|
||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
import { ExternalApiService } from './external-api.service';
|
import { ExternalApiService } from './external-api.service';
|
||||||
|
import { AXIOS_INSTANCE } from '@ucap/ng-core';
|
||||||
|
import { _MODULE_CONFIG } from '../config/token';
|
||||||
|
|
||||||
describe('ExternalApiService', () => {
|
describe('ExternalApiService', () => {
|
||||||
beforeEach(() => TestBed.configureTestingModule({}));
|
let service: ExternalApiService;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
providers: [
|
||||||
|
{ provide: _MODULE_CONFIG, useValue: _MODULE_CONFIG },
|
||||||
|
{ provide: AXIOS_INSTANCE, useValue: AXIOS_INSTANCE }
|
||||||
|
]
|
||||||
|
});
|
||||||
|
service = TestBed.inject(ExternalApiService);
|
||||||
|
});
|
||||||
|
|
||||||
it('should be created', () => {
|
it('should be created', () => {
|
||||||
const service: ExternalApiService = TestBed.inject(ExternalApiService);
|
|
||||||
expect(service).toBeTruthy();
|
expect(service).toBeTruthy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,11 +2,19 @@ import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
import { BrowserNativeService } from './browser-native.service';
|
import { BrowserNativeService } from './browser-native.service';
|
||||||
|
|
||||||
|
import { AXIOS_INSTANCE } from '@ucap/ng-core';
|
||||||
|
|
||||||
describe('BrowserNativeService', () => {
|
describe('BrowserNativeService', () => {
|
||||||
beforeEach(() => TestBed.configureTestingModule({}));
|
let service: BrowserNativeService;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
providers: [{ provide: AXIOS_INSTANCE, useValue: AXIOS_INSTANCE }]
|
||||||
|
});
|
||||||
|
service = TestBed.inject(BrowserNativeService);
|
||||||
|
});
|
||||||
|
|
||||||
it('should be created', () => {
|
it('should be created', () => {
|
||||||
const service: BrowserNativeService = TestBed.inject(BrowserNativeService);
|
|
||||||
expect(service).toBeTruthy();
|
expect(service).toBeTruthy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,14 +1,142 @@
|
||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
import { AuthenticationProtocolService } from './authentication-protocol.service';
|
import { AuthenticationProtocolService } from './authentication-protocol.service';
|
||||||
|
import { LogService } from '@ucap/ng-logger';
|
||||||
|
import { ProtocolService } from '@ucap/ng-protocol';
|
||||||
|
import { _MODULE_CONFIG } from '../config/token';
|
||||||
|
import { of } from 'rxjs';
|
||||||
|
import {
|
||||||
|
LoginRequest,
|
||||||
|
SSOMode,
|
||||||
|
SVC_TYPE_LOGIN,
|
||||||
|
SSVC_TYPE_LOGIN_REQ,
|
||||||
|
LogoutRequest,
|
||||||
|
SSVC_TYPE_LOGOUT_RES,
|
||||||
|
SSVC_TYPE_LOGIN_RES
|
||||||
|
} from '@ucap/protocol-authentication';
|
||||||
|
import { DeviceType, LocaleCode } from '@ucap/core';
|
||||||
|
import { ProtocolMessage } from '@ucap/protocol';
|
||||||
|
|
||||||
describe('AuthenticationProtocolService', () => {
|
describe('AuthenticationProtocolService', () => {
|
||||||
beforeEach(() => TestBed.configureTestingModule({}));
|
const senderSeq = '10045';
|
||||||
|
let service: AuthenticationProtocolService;
|
||||||
|
let protocolServiceSpy: jasmine.SpyObj<ProtocolService>;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
const spyProtocolService = {
|
||||||
|
...jasmine.createSpyObj('ProtocolService', ['connect', 'call']),
|
||||||
|
serverMessage$: of()
|
||||||
|
};
|
||||||
|
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
providers: [
|
||||||
|
AuthenticationProtocolService,
|
||||||
|
{ provide: _MODULE_CONFIG, useValue: _MODULE_CONFIG },
|
||||||
|
{ provide: ProtocolService, useValue: spyProtocolService },
|
||||||
|
{ provide: LogService, useValue: LogService }
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
service = TestBed.inject(AuthenticationProtocolService);
|
||||||
|
protocolServiceSpy = TestBed.inject(ProtocolService) as jasmine.SpyObj<
|
||||||
|
ProtocolService
|
||||||
|
>;
|
||||||
|
});
|
||||||
|
|
||||||
it('should be created', () => {
|
it('should be created', () => {
|
||||||
const service: AuthenticationProtocolService = TestBed.inject(
|
|
||||||
AuthenticationProtocolService
|
|
||||||
);
|
|
||||||
expect(service).toBeTruthy();
|
expect(service).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Test Login', (done) => {
|
||||||
|
protocolServiceSpy.call.and.returnValue(
|
||||||
|
of<ProtocolMessage>({
|
||||||
|
serviceType: SVC_TYPE_LOGIN,
|
||||||
|
subServiceType: SSVC_TYPE_LOGIN_RES,
|
||||||
|
senderSeq,
|
||||||
|
bodyList: [
|
||||||
|
'test03',
|
||||||
|
'9826',
|
||||||
|
'9826테스트3https://dstalk.daesang.com/Extern/StreamProfileUrl.aspx?p_empno=ZZZZZZZ3사업부장하지마GUC10001090882377 01224646@daesang.com식자재사업부A330ZZZZZZZ3Test3Test3manager_enmanager_cn식자재사업부식자재사업부P ',
|
||||||
|
' 2 0',
|
||||||
|
'GUC100',
|
||||||
|
'205',
|
||||||
|
'test03',
|
||||||
|
'1',
|
||||||
|
'',
|
||||||
|
'N',
|
||||||
|
'0',
|
||||||
|
'1',
|
||||||
|
'회의중',
|
||||||
|
'테스트중',
|
||||||
|
'GUC100',
|
||||||
|
'30',
|
||||||
|
'90',
|
||||||
|
'Y',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'0',
|
||||||
|
'Y',
|
||||||
|
'Y',
|
||||||
|
'Y',
|
||||||
|
'Y',
|
||||||
|
'Y',
|
||||||
|
'stubTokenString',
|
||||||
|
'N',
|
||||||
|
'4',
|
||||||
|
'6',
|
||||||
|
' ',
|
||||||
|
'Y',
|
||||||
|
'2'
|
||||||
|
]
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
const req = {
|
||||||
|
loginId: '',
|
||||||
|
loginPw: '',
|
||||||
|
deviceType: DeviceType.PC,
|
||||||
|
deviceId: '',
|
||||||
|
token: '',
|
||||||
|
localeCode: LocaleCode.Korean,
|
||||||
|
pushId: '',
|
||||||
|
companyCode: '',
|
||||||
|
passwordEncodingType: 0,
|
||||||
|
clientVersion: '',
|
||||||
|
reconnect: false,
|
||||||
|
ip: '',
|
||||||
|
hostName: '',
|
||||||
|
ssoMode: SSOMode.NONE,
|
||||||
|
userSpecificInformation: '',
|
||||||
|
andId: '',
|
||||||
|
andPushRefreshYn: ''
|
||||||
|
} as LoginRequest;
|
||||||
|
// service.login(req)..returnValue();
|
||||||
|
service.login(req).subscribe((res) => {
|
||||||
|
// console.log(res);
|
||||||
|
expect(res).toBeDefined();
|
||||||
|
expect(res.companyCode).toBe('GUC100');
|
||||||
|
expect(res.userInfo.seq).toBeDefined();
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Test Logout', (done) => {
|
||||||
|
protocolServiceSpy.call.and.returnValue(
|
||||||
|
of<ProtocolMessage>({
|
||||||
|
serviceType: SVC_TYPE_LOGIN,
|
||||||
|
subServiceType: SSVC_TYPE_LOGOUT_RES,
|
||||||
|
senderSeq,
|
||||||
|
bodyList: ['99']
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
const req = {} as LogoutRequest;
|
||||||
|
service.logout(req).subscribe((res) => {
|
||||||
|
// console.log(res);
|
||||||
|
expect(res).toBeDefined();
|
||||||
|
expect(res.reasonCode).toBe(99);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,11 +2,67 @@ import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
import { ProtocolService } from './protocol.service';
|
import { ProtocolService } from './protocol.service';
|
||||||
|
|
||||||
|
import { _MODULE_CONFIG } from '../config/token';
|
||||||
|
import { WebSocketService } from '@ucap/ng-web-socket';
|
||||||
|
import { LogService } from '@ucap/ng-logger';
|
||||||
|
import { of } from 'rxjs';
|
||||||
|
import { SVC_TYPE_PING, SSVC_TYPE_PING_REQ } from '@ucap/protocol-ping';
|
||||||
|
|
||||||
|
const MockModuleConfig = {
|
||||||
|
requestId: {
|
||||||
|
min: 0,
|
||||||
|
max: 0
|
||||||
|
},
|
||||||
|
timeout: {
|
||||||
|
expiredTime: 0,
|
||||||
|
checkInterval: 0
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
describe('ProtocolService', () => {
|
describe('ProtocolService', () => {
|
||||||
beforeEach(() => TestBed.configureTestingModule({}));
|
let service: ProtocolService;
|
||||||
|
let logService: LogService;
|
||||||
|
let webSocketServiceSpy: jasmine.SpyObj<WebSocketService>;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
const spyWebSocketService = {
|
||||||
|
...jasmine.createSpyObj('WebSocketService', ['connect']),
|
||||||
|
socketMessage$: of()
|
||||||
|
};
|
||||||
|
|
||||||
|
logService = new LogService({});
|
||||||
|
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
providers: [
|
||||||
|
ProtocolService,
|
||||||
|
{ provide: _MODULE_CONFIG, useValue: MockModuleConfig },
|
||||||
|
{ provide: WebSocketService, useValue: spyWebSocketService },
|
||||||
|
{ provide: LogService, useValue: logService }
|
||||||
|
]
|
||||||
|
});
|
||||||
|
service = TestBed.inject(ProtocolService);
|
||||||
|
webSocketServiceSpy = TestBed.inject(WebSocketService) as jasmine.SpyObj<
|
||||||
|
WebSocketService
|
||||||
|
>;
|
||||||
|
});
|
||||||
|
|
||||||
it('should be created', () => {
|
it('should be created', () => {
|
||||||
const service: ProtocolService = TestBed.inject(ProtocolService);
|
expect(service).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('service connect', async () => {
|
||||||
|
await service.connect();
|
||||||
|
expect(service).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('service send', () => {
|
||||||
|
try {
|
||||||
|
service.send(SVC_TYPE_PING, SSVC_TYPE_PING_REQ, ...[]);
|
||||||
|
logService.debug('s send');
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
|
||||||
expect(service).toBeTruthy();
|
expect(service).toBeTruthy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,23 @@
|
||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
import { ChangePasswordComponent } from './change-password.component';
|
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', () => {
|
describe('Account::ChangePasswordComponent', () => {
|
||||||
let component: ChangePasswordComponent;
|
let component: ChangePasswordComponent;
|
||||||
|
@ -8,7 +25,33 @@ describe('Account::ChangePasswordComponent', () => {
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
TestBed.configureTestingModule({
|
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();
|
}).compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -18,7 +61,30 @@ describe('Account::ChangePasswordComponent', () => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create', () => {
|
// it('should create', () => {
|
||||||
expect(component).toBeTruthy();
|
// // 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 { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
import { LoginComponent } from './login.component';
|
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', () => {
|
describe('ui::authentication::LoginComponent', () => {
|
||||||
let component: LoginComponent;
|
let component: LoginComponent;
|
||||||
|
@ -8,7 +24,31 @@ describe('ui::authentication::LoginComponent', () => {
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
TestBed.configureTestingModule({
|
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();
|
}).compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -19,6 +59,34 @@ describe('ui::authentication::LoginComponent', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create', () => {
|
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();
|
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();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user