@@ -9,11 +9,14 @@ describe('OpenStreetMapComponent', () => {
99 let fixture : ComponentFixture < OpenStreetMapComponent > ;
1010
1111 const locationService = jasmine . createSpyObj ( 'locationService' , {
12- searchPlace : jasmine . createSpy ( 'searchPlace' ) ,
13- searchCoordinates : jasmine . createSpy ( 'searchCoordinates' ) ,
12+ findPlaceCoordinates : jasmine . createSpy ( 'findPlaceCoordinates' ) ,
13+ findPlaceAndDecimalCoordinates : jasmine . createSpy ( 'findPlaceAndDecimalCoordinates' ) ,
14+ searchByCoordinates : jasmine . createSpy ( 'searchByCoordinates' ) ,
15+ isValidDecimalCoordinatePair : jasmine . createSpy ( 'isValidDecimalCoordinatePair' ) ,
16+ isDecimalCoordinateString : jasmine . createSpy ( 'isDecimalCoordinateString' ) ,
17+ isSexagesimalCoordinateString : jasmine . createSpy ( 'isSexagesimalCoordinateString' ) ,
1418 isValidCoordinateString : jasmine . createSpy ( 'isValidCoordinateString' ) ,
1519 parseCoordinates : jasmine . createSpy ( 'parseCoordinates' ) ,
16- isCoordinateString : jasmine . createSpy ( 'isCoordinateString' ) ,
1720 } ) ;
1821
1922 const coordinates = '52.520008,13.404954' ;
@@ -65,14 +68,14 @@ describe('OpenStreetMapComponent', () => {
6568 describe ( 'when coordinates are given' , ( ) => {
6669 beforeEach ( ( ) => {
6770 component . coordinates = coordinates ;
68- locationService . isCoordinateString . and . returnValue ( true ) ;
71+ locationService . isDecimalCoordinateString . and . returnValue ( true ) ;
6972 locationService . isValidCoordinateString . and . returnValue ( true ) ;
7073 locationService . parseCoordinates . and . returnValue ( place . coordinates ) ;
7174 } ) ;
7275
7376 describe ( 'and they are found' , ( ) => {
7477 beforeEach ( ( ) => {
75- locationService . searchCoordinates . and . returnValue ( of ( place . displayName ) ) ;
78+ locationService . searchByCoordinates . and . returnValue ( of ( place . displayName ) ) ;
7679 fixture . detectChanges ( ) ;
7780 } ) ;
7881
@@ -88,7 +91,7 @@ describe('OpenStreetMapComponent', () => {
8891 describe ( 'and they are not found' , ( ) => {
8992 beforeEach ( ( ) => {
9093
91- locationService . searchCoordinates . and . callFake ( ( ) => {
94+ locationService . searchByCoordinates . and . callFake ( ( ) => {
9295 return throwError ( ( ) => new Error ( 'Fake error' ) ) ;
9396 } ) ;
9497 fixture . detectChanges ( ) ;
@@ -107,12 +110,13 @@ describe('OpenStreetMapComponent', () => {
107110 describe ( 'when address is given' , ( ) => {
108111 beforeEach ( ( ) => {
109112 component . coordinates = address ;
110- locationService . isCoordinateString . and . returnValue ( false ) ;
113+ locationService . isDecimalCoordinateString . and . returnValue ( false ) ;
111114 } ) ;
112115
113116 describe ( 'and exists' , ( ) => {
114117 beforeEach ( ( ) => {
115- locationService . searchPlace . and . returnValue ( of ( placeOnlyCoordinates ) ) ;
118+ locationService . findPlaceCoordinates . and . returnValue ( of ( placeOnlyCoordinates ) ) ;
119+ locationService . findPlaceAndDecimalCoordinates . and . returnValue ( of ( place ) ) ;
116120 fixture . detectChanges ( ) ;
117121 } ) ;
118122
@@ -128,7 +132,10 @@ describe('OpenStreetMapComponent', () => {
128132 describe ( 'and is not found' , ( ) => {
129133 beforeEach ( ( ) => {
130134
131- locationService . searchPlace . and . callFake ( ( ) => {
135+ locationService . findPlaceCoordinates . and . callFake ( ( ) => {
136+ return throwError ( ( ) => new Error ( LocationErrorCodes . API_ERROR ) ) ;
137+ } ) ;
138+ locationService . findPlaceAndDecimalCoordinates . and . callFake ( ( ) => {
132139 return throwError ( ( ) => new Error ( LocationErrorCodes . API_ERROR ) ) ;
133140 } ) ;
134141 fixture . detectChanges ( ) ;
0 commit comments