Skip to content

Commit f531825

Browse files
author
Juan Gabriel Guzman
committed
style: ioet#204 Improving code readability by removing dead code
1 parent b2a5093 commit f531825

File tree

2 files changed

+15
-21
lines changed

2 files changed

+15
-21
lines changed

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

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing';
2-
import {TestBed, inject} from '@angular/core/testing';
2+
import {inject, TestBed} from '@angular/core/testing';
33

44
import {EntryService} from './entry.service';
55
import {NewEntry} from '../../shared/models';
@@ -17,7 +17,6 @@ describe('EntryService', () => {
1717
httpMock = TestBed.inject(HttpTestingController);
1818
datePipe = TestBed.inject(DatePipe);
1919
service.baseUrl = 'time-entries';
20-
2120
});
2221

2322
it('services are ready to be used', inject(
@@ -42,24 +41,21 @@ describe('EntryService', () => {
4241
});
4342

4443
it('loads an activeEntry with /running', () => {
45-
service.loadActiveEntry().subscribe((response) => {
46-
});
44+
service.loadActiveEntry().subscribe();
4745

4846
const loadEntryRequest = httpMock.expectOne(`${service.baseUrl}/running`);
4947
expect(loadEntryRequest.request.method).toBe('GET');
5048
});
5149

5250
it('loads summary with get /summary', () => {
53-
service.summary().subscribe((response) => {
54-
});
51+
service.summary().subscribe();
5552

5653
const loadEntryRequest = httpMock.expectOne(`${service.baseUrl}/summary`);
5754
expect(loadEntryRequest.request.method).toBe('GET');
5855
});
5956

60-
it('loads all Entries', () => {
61-
service.loadEntries(new Date().getMonth).subscribe((response) => {
62-
});
57+
it('load all Entries', () => {
58+
service.loadEntries(new Date().getMonth).subscribe();
6359

6460
const loadEntryRequest = httpMock.expectOne(`${service.baseUrl}`);
6561
expect(loadEntryRequest.request.method).toBe('GET');
@@ -69,25 +65,23 @@ describe('EntryService', () => {
6965
it('update an entry using PUT', () => {
7066
const updatedEntry = {foo: 'bar', id: 'id'};
7167

72-
service.updateActiveEntry(updatedEntry).subscribe((response) => {
73-
74-
});
68+
service.updateActiveEntry(updatedEntry).subscribe();
7569

7670
const updateEntryRequest = httpMock.expectOne(`${service.baseUrl}/id`);
7771
expect(updateEntryRequest.request.method).toBe('PUT');
7872
});
7973

8074
it('delete an entry using DELETE', () => {
8175
const entry = 'entryId';
82-
service.deleteEntry(entry).subscribe((response) => {
83-
});
76+
77+
service.deleteEntry(entry).subscribe();
78+
8479
const updateEntryRequest = httpMock.expectOne(`${service.baseUrl}/${entry}`);
8580
expect(updateEntryRequest.request.method).toBe('DELETE');
8681
});
8782

8883
it('stops an entry using POST', () => {
89-
service.stopEntryRunning('id').subscribe((response) => {
90-
});
84+
service.stopEntryRunning('id').subscribe();
9185

9286
const updateEntryRequest = httpMock.expectOne(`${service.baseUrl}/id/stop`);
9387
expect(updateEntryRequest.request.method).toBe('POST');

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { TimeEntriesSummary } from '../models/time.entry.summary';
2-
import { Injectable } from '@angular/core';
3-
import { HttpClient } from '@angular/common/http';
1+
import {TimeEntriesSummary} from '../models/time.entry.summary';
2+
import {Injectable} from '@angular/core';
3+
import {HttpClient} from '@angular/common/http';
44

5-
import { Observable } from 'rxjs';
6-
import { environment } from './../../../../environments/environment';
5+
import {Observable} from 'rxjs';
6+
import {environment} from './../../../../environments/environment';
77
import {TimeEntriesTimeRange} from '../models/time-entries-time-range';
88
import {DatePipe} from '@angular/common';
99

0 commit comments

Comments
 (0)