This commit is contained in:
richard-loafle 2020-04-20 15:17:54 +09:00
commit efe731487a
11 changed files with 1167 additions and 1191 deletions

1959
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -180,7 +180,7 @@
"@ucap/ng-store-group": "file:pack/ucap-ng-store-group-0.0.6.tgz", "@ucap/ng-store-group": "file:pack/ucap-ng-store-group-0.0.6.tgz",
"@ucap/ng-store-organization": "file:pack/ucap-ng-store-organization-0.0.4.tgz", "@ucap/ng-store-organization": "file:pack/ucap-ng-store-organization-0.0.4.tgz",
"@ucap/ng-ui": "file:pack/ucap-ng-ui-0.0.3.tgz", "@ucap/ng-ui": "file:pack/ucap-ng-ui-0.0.3.tgz",
"@ucap/ng-ui-authentication": "file:pack/ucap-ng-ui-authentication-0.0.15.tgz", "@ucap/ng-ui-authentication": "file:pack/ucap-ng-ui-authentication-0.0.16.tgz",
"@ucap/ng-ui-organization": "file:pack/ucap-ng-ui-organization-0.0.2.tgz", "@ucap/ng-ui-organization": "file:pack/ucap-ng-ui-organization-0.0.2.tgz",
"@ucap/ng-ui-skin-default": "file:pack/ucap-ng-ui-skin-default-0.0.1.tgz", "@ucap/ng-ui-skin-default": "file:pack/ucap-ng-ui-skin-default-0.0.1.tgz",
"@ucap/ng-web-socket": "file:pack/ucap-ng-web-socket-0.0.2.tgz", "@ucap/ng-web-socket": "file:pack/ucap-ng-web-socket-0.0.2.tgz",
@ -234,5 +234,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"
} }
} }

View File

@ -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();
}); });
}); });

View File

@ -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();
}); });
}); });

View File

@ -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();
}); });
}); });

View File

@ -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();
});
});
}); });

View File

@ -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();
}); });
}); });

View File

@ -1,6 +1,6 @@
{ {
"name": "@ucap/ng-ui-authentication", "name": "@ucap/ng-ui-authentication",
"version": "0.0.15", "version": "0.0.16",
"publishConfig": { "publishConfig": {
"registry": "http://10.81.13.221:8081/nexus/repository/npm-ucap/" "registry": "http://10.81.13.221:8081/nexus/repository/npm-ucap/"
}, },

View File

@ -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();
// });
}); });

View File

@ -20,13 +20,14 @@
</mat-form-field> </mat-form-field>
<div class="input-lineless"> <div class="input-lineless">
12345
<!--<span class="icon-img"><i class="mid mdi-account-tie-outline"></i></span>--> <!--<span class="icon-img"><i class="mid mdi-account-tie-outline"></i></span>-->
<span class="icon-img"> <span class="icon-img">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20.82 22"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20.82 22">
<path <path
d="M14.39,11.88a5.7,5.7,0,1,0-4.78,0A10.41,10.41,0,0,0,1.59,22v1H22.41V22A10.41,10.41,0,0,0,14.39,11.88Z" d="M14.39,11.88a5.7,5.7,0,1,0-4.78,0A10.41,10.41,0,0,0,1.59,22v1H22.41V22A10.41,10.41,0,0,0,14.39,11.88Z"
transform="translate(-1.59 -1)" transform="translate(-1.59 -1)"
style="fill:#fff" style="fill: #fff;"
/> />
<path <path
d="M14.39,11.88a5.7,5.7,0,1,0-4.78,0A10.41,10.41,0,0,0,1.59,22v1H22.41V22A10.41,10.41,0,0,0,14.39,11.88ZM8.3,6.7A3.71,3.71,0,1,1,12,10.41,3.7,3.7,0,0,1,8.3,6.7ZM3.65,21a8.42,8.42,0,0,1,7.58-7.37L10,16.58l2,2,2-2-1.23-2.95A8.42,8.42,0,0,1,20.35,21Z" d="M14.39,11.88a5.7,5.7,0,1,0-4.78,0A10.41,10.41,0,0,0,1.59,22v1H22.41V22A10.41,10.41,0,0,0,14.39,11.88ZM8.3,6.7A3.71,3.71,0,1,1,12,10.41,3.7,3.7,0,0,1,8.3,6.7ZM3.65,21a8.42,8.42,0,0,1,7.58-7.37L10,16.58l2,2,2-2-1.23-2.95A8.42,8.42,0,0,1,20.35,21Z"
@ -48,7 +49,7 @@
<path <path
d="M19,10H18V7A6,6,0,0,0,6,7v3H5a3,3,0,0,0-3,3v7a3,3,0,0,0,3,3H19a3,3,0,0,0,3-3V13A3,3,0,0,0,19,10Z" d="M19,10H18V7A6,6,0,0,0,6,7v3H5a3,3,0,0,0-3,3v7a3,3,0,0,0,3,3H19a3,3,0,0,0,3-3V13A3,3,0,0,0,19,10Z"
transform="translate(-2 -0.93)" transform="translate(-2 -0.93)"
style="fill:#fff" style="fill: #fff;"
/> />
<rect x="9.08" y="12.94" width="1.84" height="3.72" /> <rect x="9.08" y="12.94" width="1.84" height="3.72" />
<path <path
@ -64,7 +65,7 @@
y="13.36" y="13.36"
width="0.84" width="0.84"
height="2.72" height="2.72"
style="fill:#fff" style="fill: #fff;"
/> />
<rect x="9.08" y="12.86" width="1.84" height="3.72" /> <rect x="9.08" y="12.86" width="1.84" height="3.72" />
</svg> </svg>

View File

@ -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();
});
}); });