Skip to content

Commit aabefaf

Browse files
committed
refactor: TTA-115 changed test descriptions - lint
1 parent 5bc7915 commit aabefaf

File tree

4 files changed

+20
-19
lines changed

4 files changed

+20
-19
lines changed

src/app/modules/internet-connection-status/internet-connection-directives/connection.directive.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,15 @@ export class ConnectionDirective implements OnInit {
1515

1616
ngOnInit() {
1717
const { effectiveType } = navigator.connection;
18-
let networkSatus;
18+
let networkStatus;
1919
if (/\fast-5g|3g|4g/.test(effectiveType)) {
20-
networkSatus = this.fastSrc;
21-
return;
20+
networkStatus = this.fastSrc;
21+
} else if (/\slow-2g|2g/.test(effectiveType)) {
22+
networkStatus = this.slowSrc;
23+
} else {
24+
networkStatus = this.offlineSrc;
2225
}
23-
if (/\slow-2g|2g/.test(effectiveType)) {
24-
networkSatus = this.slowSrc;
25-
return;
26-
}
27-
networkSatus = this.offlineSrc;
2826

29-
this.host.nativeElement.setAttribute('src', networkSatus);
27+
this.host.nativeElement.setAttribute('src', networkStatus);
3028
}
3129
}

src/app/modules/internet-connection-status/internet-connection-status.component.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,21 @@ describe('InternetConnectionStatusComponent', () => {
3232
fixture.detectChanges();
3333
});
3434

35-
it('should show a stable connection warning', () => {
35+
it('component.isFast should be true when the connection is 4g', () => {
3636
component.connection$ = of('4g');
3737
fixture.detectChanges();
3838
component.ngOnInit();
3939
expect(component.isFast).toBe(true);
4040
});
4141

42-
it('should show a slow connection warning', () => {
42+
it('component.isFast should be false when the connection is 2g', () => {
4343
component.connection$ = of('2g');
4444
fixture.detectChanges();
4545
component.ngOnInit();
4646
expect(component.isFast).toBe(false);
4747
});
4848

49-
it('should show offline warning', () => {
49+
it('component.isFast should be false when the connection is Offline', () => {
5050
component.connection$ = of('Offline');
5151
fixture.detectChanges();
5252
component.ngOnInit();

src/app/modules/internet-connection-status/internet-connection-status.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ export class InternetConnectionStatusComponent implements OnInit {
6969
this.connectionType = effectiveType;
7070

7171
if (/\fast-5g|3g|4g/.test(effectiveType)) {
72-
this.toastrService.error('Your request was not completed, you are offline');
7372
this.isFast = true;
7473
return;
7574
}
7675
if (/\slow-2g|2g/.test(effectiveType)) {
77-
this.toastrService.warning('Caution your connection is slow');
78-
this.isFast = false;
79-
return;
76+
this.toastrService.warning('Caution your connection is slow');
77+
this.isFast = false;
78+
return;
8079
}
80+
this.toastrService.warning('Caution your connection is slow');
8181
this.isFast = false;
8282
});
8383
}

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ export class EntryEffects {
3737
return new actions.ClockIn(entry);
3838
}),
3939
catchError((error) => {
40-
this.statusNetworkService.showTypeToastrServiceAlert({error, message: 'We could not perform this operation, try again later', isError: false});
40+
this.statusNetworkService.showTypeToastrServiceAlert(
41+
{error, message: 'We could not perform this operation, try again later', isError: false});
4142
return of(new actions.StopTimeEntryRunningFail(error));
4243
})
4344
)
@@ -56,7 +57,8 @@ export class EntryEffects {
5657
return new actions.LoadEntriesSummarySuccess(response);
5758
}),
5859
catchError((error) => {
59-
this.statusNetworkService.showTypeToastrServiceAlert({error, message: 'Your summary information could not be loaded', isError: false});
60+
this.statusNetworkService.showTypeToastrServiceAlert(
61+
{error, message: 'Your summary information could not be loaded', isError: false});
6062
return of(new actions.LoadEntriesSummaryFail());
6163
})
6264
)
@@ -151,7 +153,8 @@ export class EntryEffects {
151153
if (error.status === 404) {
152154
return of(new actions.CreateEntry(entry));
153155
} else {
154-
this.statusNetworkService.showTypeToastrServiceAlert({error, message: 'We could not clock you in, try again later.', isError: true});
156+
this.statusNetworkService.showTypeToastrServiceAlert(
157+
{error, message: 'We could not clock you in, try again later.', isError: true});
155158
return of(new actions.CreateEntryFail('Error'));
156159
}
157160
})

0 commit comments

Comments
 (0)