Permalink
Browse files

chore(package): update deps

  • Loading branch information...
Burak Tasci
Burak Tasci committed Dec 24, 2018
1 parent be9b4f9 commit ac5aaa52f29e1dae98188bd6c3ba986daa5f62e5
Showing with 124 additions and 110 deletions.
  1. +15 −15 package.json
  2. +3 −2 src/app/layout/header.component.ts
  3. +27 −22 src/app/login/login.component.spec.ts
  4. +11 −10 src/app/login/login.component.ts
  5. +68 −61 yarn.lock
@@ -56,26 +56,26 @@
"@angular/platform-server": "~7.2.0-rc.0",
"@angular/router": "~7.2.0-rc.0",
"@angularclass/bootloader": "~1.0.1",
"@ngrx/effects": "~7.0.0-beta.1",
"@ngrx/entity": "~7.0.0-beta.1",
"@ngrx/store": "~7.0.0-beta.1",
"@ngrx/effects": "~7.0.0",
"@ngrx/entity": "~7.0.0",
"@ngrx/store": "~7.0.0",
"@nguniversal/common": "~7.0.2",
"@nguniversal/express-engine": "~7.0.2",
"@nguniversal/module-map-ngfactory-loader": "~7.0.2",
"@ngx-auth/core": "~6.0.0",
"@ngx-cache/core": "~6.0.0",
"@ngx-cache/fs-storage": "~6.0.0",
"@ngx-cache/platform-browser": "~6.0.0",
"@ngx-cache/platform-server": "~6.0.0",
"@ngx-config/core": "~6.0.0",
"@ngx-config/http-loader": "~6.0.0",
"@ngx-meta/core": "~6.0.0",
"@ngx-auth/core": "~7.0.0",
"@ngx-cache/core": "~7.0.0",
"@ngx-cache/fs-storage": "~7.0.0",
"@ngx-cache/platform-browser": "~7.0.0",
"@ngx-cache/platform-server": "~7.0.0",
"@ngx-config/core": "~7.0.0",
"@ngx-config/http-loader": "~7.0.0",
"@ngx-meta/core": "~7.0.0",
"@ngx-translate/core": "~11.0.1",
"@ngx-translate/http-loader": "~4.0.0",
"angulartics2": "~7.2.3",
"angulartics2": "~7.2.4",
"compression": "~1.7.3",
"core-js": "~2.6.1",
"debug": "~4.1.0",
"debug": "~4.1.1",
"express": "~4.16.4",
"hammerjs": "~2.0.8",
"lodash": "~4.17.11",
@@ -100,8 +100,8 @@
"@commitlint/cli": "~7.2.1",
"@commitlint/config-conventional": "~7.1.2",
"@compodoc/compodoc": "~1.1.7",
"@ngrx/schematics": "~7.0.0-beta.1",
"@ngrx/store-devtools": "~7.0.0-beta.1",
"@ngrx/schematics": "~7.0.0",
"@ngrx/store-devtools": "~7.0.0",
"@types/compression": "~0.0.36",
"@types/express": "~4.16.0",
"@types/jest": "~23.3.10",
@@ -30,8 +30,9 @@ export class HeaderComponent extends BaseComponent implements OnInit {
this.isAuthenticated = this.auth.isAuthenticated;
}

logout(): void {
async logout(): Promise<boolean> {
this.isAuthenticated = false;
this.auth.invalidate();

return this.auth.invalidate();
}
}
@@ -69,34 +69,39 @@ t.describe('login: LoginComponent', () => {
)
);

t.it('should authenticate w/valid combination', () => {
const fixture = TestBed.createComponent(LoginComponent);
const instance = fixture.debugElement.componentInstance;
fixture.detectChanges();

instance.username = 'valid';
instance.password = 'valid';
instance.login();

t.e(instance.note$).toBeDefined();
t.e(instance.error$).toBeUndefined();
});

t.it(
'should not authenticate w/o valid combination',
t.inject([AuthService], (auth: AuthService) => {
auth.invalidate();

'should authenticate w/valid combination',
t.async(() => {
const fixture = TestBed.createComponent(LoginComponent);
const instance = fixture.debugElement.componentInstance;
fixture.detectChanges();

instance.username = 'invalid';
instance.password = 'invalid';
instance.login();
instance.username = 'valid';
instance.password = 'valid';

t.e(instance.note$).toBeDefined();
t.e(instance.error$).toBeDefined();
instance.login().subscribe(() => {
t.e(instance.note$).toBeDefined();
t.e(instance.error$).toBeUndefined();
});
})
);

t.it(
'should not authenticate w/o valid combination',
t.inject([AuthService], async (auth: AuthService) =>
auth.invalidate().then(() => {
const fixture = TestBed.createComponent(LoginComponent);
const instance = fixture.debugElement.componentInstance;
fixture.detectChanges();

instance.username = 'invalid';
instance.password = 'invalid';

instance.login().subscribe(() => {
t.e(instance.note$).toBeDefined();
t.e(instance.error$).toBeDefined();
});
})
)
);
});
@@ -34,19 +34,20 @@ export class LoginComponent extends BaseComponent implements OnInit {
}
}

login(): void {
login(): Observable<any> {
this.isProcessing = true;
this.note$ = this.translate.get('PUBLIC.LOGIN.NOTE');

this.auth
.authenticate(this.username, this.password)
.pipe(takeUntil(this.ngUnsubscribe))
.subscribe(() => {
this.isProcessing = false;
const auth$ = this.auth.authenticate(this.username, this.password).pipe(takeUntil(this.ngUnsubscribe));

if (!this.auth.isAuthenticated) {
this.error$ = this.translate.get('PUBLIC.LOGIN.ERROR');
}
});
auth$.subscribe(() => {
this.isProcessing = false;

if (!this.auth.isAuthenticated) {
this.error$ = this.translate.get('PUBLIC.LOGIN.ERROR');
}
});

return auth$;
}
}
129 yarn.lock

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit ac5aaa5

Please sign in to comment.