@@ -12,13 +12,13 @@ describe('GET /geospatial/addresses/postcode?postcode=', () => {
1212 let api : Api ;
1313
1414 const {
15- ordnanceSurveyPath ,
16- mdmPath ,
17- getAddressByPostcodeResponse ,
18- getAddressByPostcodeMultipleResponse ,
19- getAddressOrdnanceSurveyResponse ,
20- getAddressOrdnanceSurveyEmptyResponse ,
21- getAddressOrdnanceSurveyMultipleResponse ,
15+ ordnanceSurveyPaths ,
16+ mdmPaths ,
17+ getAddressesByPostcodeResponse ,
18+ getAddressesByPostcodeMultipleResponse ,
19+ getAddressesOrdnanceSurveyResponse ,
20+ getAddressesOrdnanceSurveyEmptyResponse ,
21+ getAddressesOrdnanceSurveyMultipleMatchingAddressesResponse ,
2222 ordnanceSurveyAuthErrorResponse,
2323 } = new GetGeospatialAddressesGenerator ( valueGenerator ) . generate ( {
2424 postcode : GEOSPATIAL . EXAMPLES . POSTCODE ,
@@ -44,42 +44,42 @@ describe('GET /geospatial/addresses/postcode?postcode=', () => {
4444 // MDM auth tests
4545 withClientAuthenticationTests ( {
4646 givenTheRequestWouldOtherwiseSucceed : ( ) => {
47- requestToGetAddressesByPostcode ( ordnanceSurveyPath [ 0 ] ) . reply ( 200 , getAddressOrdnanceSurveyResponse [ 0 ] ) ;
47+ requestToGetAddressesByPostcode ( ordnanceSurveyPaths [ 0 ] ) . reply ( 200 , getAddressesOrdnanceSurveyResponse [ 0 ] ) ;
4848 } ,
49- makeRequestWithoutAuth : ( incorrectAuth ?: IncorrectAuthArg ) => api . getWithoutAuth ( mdmPath [ 0 ] , incorrectAuth ?. headerName , incorrectAuth ?. headerValue ) ,
49+ makeRequestWithoutAuth : ( incorrectAuth ?: IncorrectAuthArg ) => api . getWithoutAuth ( mdmPaths [ 0 ] , incorrectAuth ?. headerName , incorrectAuth ?. headerValue ) ,
5050 } ) ;
5151
5252 it ( 'returns a 200 response with the address if it is returned by Ordnance Survey API' , async ( ) => {
53- requestToGetAddressesByPostcode ( ordnanceSurveyPath [ 0 ] ) . reply ( 200 , getAddressOrdnanceSurveyResponse [ 0 ] ) ;
53+ requestToGetAddressesByPostcode ( ordnanceSurveyPaths [ 0 ] ) . reply ( 200 , getAddressesOrdnanceSurveyResponse [ 0 ] ) ;
5454
55- const { status, body } = await api . get ( mdmPath [ 0 ] ) ;
55+ const { status, body } = await api . get ( mdmPaths [ 0 ] ) ;
5656
5757 expect ( status ) . toBe ( 200 ) ;
58- expect ( body ) . toStrictEqual ( getAddressByPostcodeResponse [ 0 ] ) ;
58+ expect ( body ) . toStrictEqual ( getAddressesByPostcodeResponse [ 0 ] ) ;
5959 } ) ;
6060
6161 it ( 'returns a 200 response with the addresses if they are returned by Ordnance Survey API' , async ( ) => {
62- requestToGetAddressesByPostcode ( ordnanceSurveyPath [ 0 ] ) . reply ( 200 , getAddressOrdnanceSurveyMultipleResponse ) ;
62+ requestToGetAddressesByPostcode ( ordnanceSurveyPaths [ 0 ] ) . reply ( 200 , getAddressesOrdnanceSurveyMultipleMatchingAddressesResponse ) ;
6363
64- const { status, body } = await api . get ( mdmPath [ 0 ] ) ;
64+ const { status, body } = await api . get ( mdmPaths [ 0 ] ) ;
6565
6666 expect ( status ) . toBe ( 200 ) ;
67- expect ( body ) . toStrictEqual ( getAddressByPostcodeMultipleResponse ) ;
67+ expect ( body ) . toStrictEqual ( getAddressesByPostcodeMultipleResponse ) ;
6868 } ) ;
6969
7070 it ( 'returns an empty 200 response if Ordnance Survey API returns a 200 without results' , async ( ) => {
71- requestToGetAddressesByPostcode ( ordnanceSurveyPath [ 0 ] ) . reply ( 200 , getAddressOrdnanceSurveyEmptyResponse [ 0 ] ) ;
71+ requestToGetAddressesByPostcode ( ordnanceSurveyPaths [ 0 ] ) . reply ( 200 , getAddressesOrdnanceSurveyEmptyResponse [ 0 ] ) ;
7272
73- const { status, body } = await api . get ( mdmPath [ 0 ] ) ;
73+ const { status, body } = await api . get ( mdmPaths [ 0 ] ) ;
7474
7575 expect ( status ) . toBe ( 200 ) ;
7676 expect ( body ) . toStrictEqual ( [ ] ) ;
7777 } ) ;
7878
7979 it ( 'returns a 500 response if Ordnance Survey API returns a status code 401' , async ( ) => {
80- requestToGetAddressesByPostcode ( ordnanceSurveyPath [ 0 ] ) . reply ( 401 ) ;
80+ requestToGetAddressesByPostcode ( ordnanceSurveyPaths [ 0 ] ) . reply ( 401 ) ;
8181
82- const { status, body } = await api . get ( mdmPath [ 0 ] ) ;
82+ const { status, body } = await api . get ( mdmPaths [ 0 ] ) ;
8383
8484 expect ( status ) . toBe ( 500 ) ;
8585 expect ( body ) . toStrictEqual ( {
@@ -89,9 +89,9 @@ describe('GET /geospatial/addresses/postcode?postcode=', () => {
8989 } ) ;
9090
9191 it ( 'returns a 500 response if Ordnance Survey API returns a status code 404' , async ( ) => {
92- requestToGetAddressesByPostcode ( ordnanceSurveyPath [ 0 ] ) . reply ( 404 ) ;
92+ requestToGetAddressesByPostcode ( ordnanceSurveyPaths [ 0 ] ) . reply ( 404 ) ;
9393
94- const { status, body } = await api . get ( mdmPath [ 0 ] ) ;
94+ const { status, body } = await api . get ( mdmPaths [ 0 ] ) ;
9595
9696 expect ( status ) . toBe ( 500 ) ;
9797 expect ( body ) . toStrictEqual ( {
@@ -101,9 +101,9 @@ describe('GET /geospatial/addresses/postcode?postcode=', () => {
101101 } ) ;
102102
103103 it ( 'returns a 500 response if Ordnance Survey API times out' , async ( ) => {
104- requestToGetAddressesByPostcode ( ordnanceSurveyPath [ 0 ] ) . delay ( TIME_EXCEEDING_ORDNANCE_SURVEY_TIMEOUT ) . reply ( 200 , getAddressOrdnanceSurveyResponse [ 0 ] ) ;
104+ requestToGetAddressesByPostcode ( ordnanceSurveyPaths [ 0 ] ) . delay ( TIME_EXCEEDING_ORDNANCE_SURVEY_TIMEOUT ) . reply ( 200 , getAddressesOrdnanceSurveyResponse [ 0 ] ) ;
105105
106- const { status, body } = await api . get ( mdmPath [ 0 ] ) ;
106+ const { status, body } = await api . get ( mdmPaths [ 0 ] ) ;
107107
108108 expect ( status ) . toBe ( 500 ) ;
109109 expect ( body ) . toStrictEqual ( {
@@ -113,9 +113,9 @@ describe('GET /geospatial/addresses/postcode?postcode=', () => {
113113 } ) ;
114114
115115 it ( 'returns a 500 response if Ordnance Survey API returns error' , async ( ) => {
116- requestToGetAddressesByPostcode ( ordnanceSurveyPath [ 0 ] ) . reply ( 401 , ordnanceSurveyAuthErrorResponse ) ;
116+ requestToGetAddressesByPostcode ( ordnanceSurveyPaths [ 0 ] ) . reply ( 401 , ordnanceSurveyAuthErrorResponse ) ;
117117
118- const { status, body } = await api . get ( mdmPath [ 0 ] ) ;
118+ const { status, body } = await api . get ( mdmPaths [ 0 ] ) ;
119119
120120 expect ( status ) . toBe ( 500 ) ;
121121 expect ( body ) . toStrictEqual ( {
0 commit comments