Skip to content

Deepika test - #14

Open
app-dev-198 wants to merge 4 commits into
wearewiser:masterfrom
app-dev-198:deepika-test
Open

app-dev-198 wants to merge 4 commits into
wearewiser:masterfrom
app-dev-198:deepika-test

Conversation

@app-dev-198

Copy link
Copy Markdown

No description provided.

@johnfedoruk johnfedoruk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated Testing:

  • Lint: passes
  • test: fails
  • coverage: fails
  • build: pass

Manual Review

  • Has Angular animations
  • Good use of services
  • Has auth guards
  • No readme describing changes
  • Good use of forms (except password field with type=text)
  • Lazy loading modules
  • Broken route in AuthGuard
  • Async looks good
  • Use of local storage for a JWT is a security vulnerability.
  • Not great directory structure (all components to go directly into their respective module?)
  • Would like to see more typescript features (privacy modifiers / return types / type setting)

@Injectable()
export class AuthService {

loginUrl: any = 'https://dev-test-service.madebywiser.com/login';

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't need to be type: any
Should have a privacy modifier
Could be getting this value from the environment file


loginUrl: any = 'https://dev-test-service.madebywiser.com/login';

authenticationUrl: any = 'https://dev-test-service.madebywiser.com/me';

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't need to be type: any
Should have a privacy modifier
Could be getting this value from the environment file

public profile: BehaviorSubject < object > = new BehaviorSubject < object > ({});
constructor(private http: HttpClient) {}

login(user) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be very nice to have privacy modifiers and return types on these methods

it('should delete token', inject([AuthService], (service: AuthService) => {
service.setToken('xyxxxx');
const token = service.deleteToken();
expect(token).toBeUndefined();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

});

it('should return true', inject([AuthGuardService], (guard: AuthGuardService) => {
expect(guard.canActivate()).toBeFalsy();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'should return true'
expect to be falsy?

Comment thread src/app/animations.ts

// Component transition animations
export const slideInDownAnimation =
trigger('routeAnimation', [

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good

}

setToken(token) {
localStorage.setItem('token', token);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

localStorage for an access token? This could be seen as a security vulnerability.

Comment thread src/app/app.module.ts
component: ErrorComponent
},
{
path: 'login-error',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be in the AuthModule

styleUrls: ['./login-error.component.css'],
animations: [ slideInDownAnimation ]
})
export class LoginErrorComponent implements OnInit {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be in the AuthModule

@@ -0,0 +1,44 @@
import { Component, HostBinding, OnInit } from '@angular/core';

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Components (pages/partials) should probably be organized (grouped) into a common child directory of their respective module

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants