Skip to content

Commit

Permalink
Pare down SBSMockResponse to remove unused mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
aokj4ck committed Feb 14, 2024
1 parent 2fe6b25 commit 906a214
Showing 1 changed file with 3 additions and 38 deletions.
41 changes: 3 additions & 38 deletions Tests/MapboxSearchUITests/MockWebServer/MockResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,14 @@ enum SBSMockResponse: MockResponse {
case suggestWithCoordinates
case suggestWithMixedCoordinates
case suggestCategoryWithCoordinates
case suggestAddressSanFrancisco

case retrieveSanFrancisco
case retrieveMinsk
case retrieveCategory
case retrievePoi
case multiRetrieve
case retrieveAddressSanFrancisco

case recursion
case forwardGeocoding
case reverseGeocoding
case reverseGeocodingSBS
case categoryCafe

var filepath: String {
Expand Down Expand Up @@ -119,36 +114,17 @@ enum SBSMockResponse: MockResponse {
return bundle.path(forResource: "retrieve-poi", ofType: "json")!
case .recursion:
return bundle.path(forResource: "recursion", ofType: "json")!
case .reverseGeocodingSBS:
return bundle.path(forResource: "reverse-geocoding-sbs", ofType: "json")!
case .reverseGeocoding:
return bundle.path(forResource: "geocoding-reverse-geocoding", ofType: "json")!
case .forwardGeocoding:
return bundle.path(forResource: "mapbox.places.san.francisco", ofType: "json")!
case .multiRetrieve:
return bundle.path(forResource: "retrieve-multi", ofType: "json")!
case .categoryCafe:
return bundle.path(forResource: "category-cafe", ofType: "json")!
case .suggestAddressSanFrancisco:
return bundle.path(forResource: "address-suggestions-san-francisco", ofType: "json")!
case .retrieveAddressSanFrancisco:
return bundle.path(forResource: "address-retrieve-san-francisco", ofType: "json")!
}
}

var path: String {
var path = "/search/v1"

switch self {
case .suggestAddressSanFrancisco:
path = "/autofill/v1/suggest/:query"

case .retrieveAddressSanFrancisco:
path = "/autofill/v1/retrieve/:action.id"

case .forwardGeocoding:
path = "/geocoding/v5/mapbox.places/:query"

case .suggestMinsk:
path += "/suggest/Minsk"

Expand All @@ -159,8 +135,8 @@ enum SBSMockResponse: MockResponse {
.suggestCategories,
.suggestWithCoordinates,
.suggestWithMixedCoordinates,
.suggestCategoryWithCoordinates,
.recursion:
.recursion,
.suggestCategoryWithCoordinates:
path += "/suggest/:query"

case .retrieveSanFrancisco,
Expand All @@ -169,12 +145,6 @@ enum SBSMockResponse: MockResponse {
.retrievePoi:
path += "/retrieve"

case .reverseGeocoding:
path = "geocoding/v5/mapbox.places/:location"

case .reverseGeocodingSBS:
path += "/:coordinates"

case .multiRetrieve:
path += "/retrieve/multi"

Expand All @@ -187,19 +157,14 @@ enum SBSMockResponse: MockResponse {

var httpMethod: HttpServer.HTTPMethod {
switch self {
case .suggestAddressSanFrancisco,
.retrieveAddressSanFrancisco,
.forwardGeocoding,
.suggestMinsk,
case .suggestMinsk,
.suggestSanFrancisco,
.suggestEmpty,
.suggestCategories,
.suggestWithCoordinates,
.suggestWithMixedCoordinates,
.suggestCategoryWithCoordinates,
.recursion,
.reverseGeocoding,
.reverseGeocodingSBS,
.categoryCafe:
return .get

Expand Down

0 comments on commit 906a214

Please sign in to comment.