Skip to content

Commit 54ee776

Browse files
TTA-141: fixing eslint and remove code unnecessary
1 parent 2085ba7 commit 54ee776

File tree

10 files changed

+25
-26
lines changed

10 files changed

+25
-26
lines changed

src/app/modules/login/login.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ describe('LoginComponent', () => {
4949
id: 'user_id',
5050
tenant_id: 'tenant_test',
5151
deleted: 'no',
52-
}
52+
};
5353

5454
const featureToggleCookiesServiceStub = {
5555
setCookies() {

src/app/modules/login/login.component.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@ export class LoginComponent implements OnInit {
5050
this.azureAdB2CService.signIn().subscribe(() => {
5151
this.featureToggleCookiesService.setCookies();
5252
this.azureAdB2CService.setCookies();
53-
const userId = this.azureAdB2CService.getUserId()
53+
const userId = this.azureAdB2CService.getUserId();
5454
this.userService.loadUser(userId).subscribe((user) => {
55-
const user_groups = {
55+
const userGroups = {
5656
groups: user.groups
57-
}
58-
this.loginService.setLocalStorage('user', JSON.stringify(user_groups));
57+
};
58+
this.loginService.setLocalStorage('user', JSON.stringify(userGroups));
5959
this.router.navigate(['']);
60-
})
60+
});
6161
});
6262
}
6363
}

src/app/modules/login/services/login.service.spec.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { HttpClient } from '@angular/common/http';
2-
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
2+
import { HttpClientTestingModule } from '@angular/common/http/testing';
33
import { TestBed } from '@angular/core/testing';
44
import { JwtHelperService } from '@auth0/angular-jwt';
55
import { SocialAuthService } from 'angularx-social-login';
@@ -10,7 +10,6 @@ import { LoginService } from './login.service';
1010

1111
describe('LoginService', () => {
1212
let service: LoginService;
13-
let httpMock: HttpTestingController;
1413
let cookieService: CookieService;
1514
let socialAuthService: SocialAuthService;
1615
let account;
@@ -33,7 +32,6 @@ describe('LoginService', () => {
3332
});
3433
service = TestBed.inject(LoginService);
3534
cookieService = TestBed.inject(CookieService);
36-
httpMock = TestBed.inject(HttpTestingController);
3735
socialAuthService = TestBed.inject(SocialAuthService);
3836
account = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6ImFiYyIsIm5hbWUiOiJhYmMiLCJlbWFpbCI6ImFiYyIsImdyb3VwcyI6WyJhYmMiXX0.UNxyDT8XzXJhI1F3LySBU7TJlpENPUPHj8my7Obw2ZM';
3937
let store = {};
@@ -94,14 +92,14 @@ describe('LoginService', () => {
9492
});
9593

9694
it('load a user by sending a token using POST', () => {
97-
const token = 'test_123'
95+
const token = 'test_123';
9896
service.baseUrl = '/users';
9997
const mockSuccessDataPost = {
10098
SUCCESS: true,
10199
data: {}
102-
}
100+
};
103101
httpClientSpy.post.and.returnValue(of(mockSuccessDataPost));
104-
service.getUser('token').subscribe();
102+
service.getUser(token).subscribe();
105103
expect(httpClientSpy.post).toHaveBeenCalled();
106104
});
107105

@@ -161,12 +159,12 @@ describe('LoginService', () => {
161159
it('should call setLocalStorage when there is a new_token ', () => {
162160
spyOn(cookieService, 'check').and.returnValue(true);
163161
spyOn(service, 'setLocalStorage');
164-
const token = 'test123'
162+
const token = 'test123';
165163
service.baseUrl = '/users';
166164
const mockSuccessDataPost = {
167165
SUCCESS: true,
168166
new_token: 'test_token'
169-
}
167+
};
170168
httpClientSpy.post.and.returnValue(of(mockSuccessDataPost));
171169
service.isValidToken(token).subscribe();
172170
expect(service.setLocalStorage).toHaveBeenCalled();

src/app/modules/reports/components/time-entries-table/time-entries-table.component.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,10 @@ describe('Reports Page', () => {
212212

213213
it('the sume of hours of entries selected is equal to {hours:0, minutes:0, seconds:0}', () => {
214214
let checked = true;
215-
let {hours, minutes, seconds}:TotalHours = component.sumHoursEntriesSelected(timeEntryList[0], checked);
215+
let {hours, minutes, seconds}: TotalHours = component.sumHoursEntriesSelected(timeEntryList[0], checked);
216216
checked = false;
217-
({hours, minutes,seconds} = component.sumHoursEntriesSelected(timeEntryList[0], checked));
218-
expect({hours, minutes, seconds}).toEqual({hours:0, minutes:0, seconds:0});
217+
({hours, minutes, seconds} = component.sumHoursEntriesSelected(timeEntryList[0], checked));
218+
expect({hours, minutes, seconds}).toEqual({hours: 0, minutes: 0, seconds: 0});
219219
});
220220

221221
it('should export data with the correct format', () => {

src/app/modules/reports/components/time-entries-table/time-entries-table.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export class TimeEntriesTableComponent implements OnInit, OnDestroy, AfterViewIn
6969
},
7070
],
7171
columnDefs: [{ type: 'date', targets: 2}, {orderable: false, targets: [0]}],
72-
order: [[1,'asc'],[2,'desc'],[4,'desc']]
72+
order: [[1, 'asc'], [2, 'desc'], [4, 'desc']]
7373
};
7474
dtTrigger: Subject<any> = new Subject();
7575
@ViewChild(DataTableDirective, { static: false })
@@ -79,7 +79,7 @@ export class TimeEntriesTableComponent implements OnInit, OnDestroy, AfterViewIn
7979
rerenderTableSubscription: Subscription;
8080
resultSum: TotalHours;
8181
resultSumEntriesSelected: TotalHours;
82-
resultSumEntriesSelected$:Observable<TotalHours>;
82+
resultSumEntriesSelected$: Observable<TotalHours>;
8383
totalHoursSubscription: Subscription;
8484
dateTimeOffset: ParseDateTimeOffset;
8585

src/app/modules/time-clock/pages/time-clock.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class TimeClockComponent implements OnInit, OnDestroy {
4343
}else{
4444
this.loginService.isLogin().subscribe(isLogin => {
4545
this.username = isLogin ? this.loginService.getName() : '';
46-
})
46+
});
4747
}
4848
this.storeSubscription = this.store.pipe(select(getActiveTimeEntry)).subscribe((activeTimeEntry) => {
4949
this.activeTimeEntry = activeTimeEntry;

src/app/modules/time-clock/services/entry.service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ export class EntryService {
4646
}
4747

4848
stopEntryRunning(idEntry: string): Observable<any> {
49-
return (this.urlInProductionLegacy ? this.http.post(`${this.baseUrl}/${idEntry}/stop`, null) : this.http.put(`${this.baseUrl}/stop`, null) );
49+
return (this.urlInProductionLegacy ?
50+
this.http.post(`${this.baseUrl}/${idEntry}/stop`, null) : this.http.put(`${this.baseUrl}/stop`, null) );
5051
}
5152

5253
restartEntry(idEntry: string): Observable<Entry> {

src/app/modules/time-clock/store/entry.reducer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ export const entryReducer = (state: EntryState = initialState, action: EntryActi
266266
return {
267267
...state,
268268
isLoading: true,
269-
resultSumEntriesSelected:{hours:0, minutes:0, seconds:0},
269+
resultSumEntriesSelected: {hours: 0, minutes: 0, seconds: 0},
270270
reportDataSource: {
271271
data: [],
272272
isLoading: true

src/app/modules/time-clock/store/entry.selectors.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ describe('Entry selectors', () => {
5555
});
5656

5757
it('should select resultSumEntriesSelected', () => {
58-
const resultSumEntriesSelected:TotalHours = { hours:0, minutes:0, seconds:0 };
58+
const resultSumEntriesSelected: TotalHours = { hours: 0, minutes: 0, seconds: 0 };
5959
const entryState = { resultSumEntriesSelected };
6060

6161
expect(selectors.getResultSumEntriesSelected.projector(entryState)).toEqual(resultSumEntriesSelected);

src/app/modules/user/services/user-info.service.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ describe('UserInfoService', () => {
7979
const groupsTT = {groups: ['fake-admin', 'fake-admin-tt']};
8080
spyOn(mockLoginService, 'getLocalStorage').and.returnValue(JSON.stringify(groupsTT));
8181
service.isLegacyProduction = true;
82-
service.isMemberOf('fake-admin').subscribe((value) => {
83-
expect(value).toEqual(true);
84-
});
82+
service.isMemberOf('fake-admin').subscribe((value) => {
83+
expect(value).toEqual(true);
84+
});
8585
});
8686

8787
});

0 commit comments

Comments
 (0)