Skip to content

Commit

Permalink
Update docs for CoreSearchEngine.ApiType.toSDKType (tests only)
Browse files Browse the repository at this point in the history
  • Loading branch information
aokj4ck committed Feb 15, 2024
1 parent 5aa4242 commit 051ef74
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
@testable import MapboxSearch

extension CoreSearchEngine.ApiType {
/// Available only for tests.
/// This is necessary for tests using subclasses and usages of ``AbstractSearchEngine`` to dynamically instantiate
/// an engine with the appropriate ApiType for their test case mocks.
/// ``AbstractSearchEngine`` and subclasses use a ``MapboxSearch.ApiType`` enum which is a **subset** of the Core
/// ApiType.
/// For all other ApiTypes specialized classes are provided that use the Core ApiType directly (such as
/// AddressAutofill) or support is not yet fully implemented (such as search-box).
/// Tests that attempt to use an Autofill or Search-box API type with a custom SearchEngine (instead of a provided
/// specialized class) should encounter a runtime error.
func toSDKType() -> ApiType? {
switch self {
case .geocoding:
Expand All @@ -9,7 +18,7 @@ extension CoreSearchEngine.ApiType {
return .SBS
case .autofill,
.searchBox:
return nil
fallthrough
@unknown default:
fatalError()
}
Expand Down

0 comments on commit 051ef74

Please sign in to comment.