File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
src/app/modules/time-clock/services Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -40,12 +40,21 @@ describe('EntryService', () => {
4040 } ) ;
4141
4242 it ( 'loads an activeEntry with /running' , ( ) => {
43+ service . showOptionInDevelopment = true ;
4344 service . loadActiveEntry ( ) . subscribe ( ) ;
4445
4546 const loadEntryRequest = httpMock . expectOne ( `${ service . baseUrl } /running` ) ;
4647 expect ( loadEntryRequest . request . method ) . toBe ( 'GET' ) ;
4748 } ) ;
4849
50+ it ( 'loads an activeEntry with /active/{userId}' , ( ) => {
51+ service . showOptionInDevelopment = false ;
52+ service . loadActiveEntry ( ) . subscribe ( ) ;
53+
54+ const loadEntryRequest = httpMock . expectOne ( `${ service . baseUrl } /active/2` ) ;
55+ expect ( loadEntryRequest . request . method ) . toBe ( 'GET' ) ;
56+ } ) ;
57+
4958 it ( 'loads summary with get /summary?time_offset=<time-offset>' , ( ) => {
5059 service . summary ( ) . subscribe ( ) ;
5160 const timeOffset = new Date ( ) . getTimezoneOffset ( ) ;
Original file line number Diff line number Diff line change 11import { TimeEntriesSummary } from '../models/time.entry.summary' ;
2- import { Injectable } from '@angular/core' ;
2+ import { Injectable , Input } from '@angular/core' ;
33import { HttpClient } from '@angular/common/http' ;
44
55import { Observable } from 'rxjs' ;
@@ -19,9 +19,16 @@ export class EntryService {
1919
2020 static TIME_ENTRIES_DATE_TIME_FORMAT = 'yyyy-MM-ddTHH:mm:ssZZZZZ' ;
2121 baseUrl = `${ environment . timeTrackerApiUrl } /time-entries` ;
22+ @Input ( ) showOptionInDevelopment : boolean ;
2223
2324 loadActiveEntry ( ) : Observable < any > {
24- return this . http . get ( `${ this . baseUrl } /running` ) ;
25+ let path = '' ;
26+ if ( this . showOptionInDevelopment ) {
27+ path = `${ this . baseUrl } /running` ;
28+ } else {
29+ path = `${ this . baseUrl } /active/2` ;
30+ }
31+ return this . http . get ( path ) ;
2532 }
2633
2734 loadEntries ( date ) : Observable < any > {
You can’t perform that action at this time.
0 commit comments