Skip to content

Commit a788cfe

Browse files
committed
Remove unnecessary getEndpoint method
1 parent f63cea4 commit a788cfe

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

Sources/Data Model/DispatchEvents/EventForDispatch.swift

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,6 @@ import Foundation
2020
public static var eventEndpoint = "https://logx.optimizely.com/v1/events"
2121
public static var euEventEndpoint = "https://eu.logx.optimizely.com/v1/events"
2222

23-
public static func getEndpoint(for region: Region) -> String {
24-
switch region {
25-
case .EU:
26-
return euEventEndpoint
27-
case .US:
28-
return eventEndpoint
29-
}
30-
}
31-
3223
public let url: URL
3324
public let body: Data
3425

Tests/OptimizelyTests-Common/BatchEventBuilderTests_Region.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class BatchEventBuilderTests_Region: XCTestCase {
6868

6969
// Check if the event was sent to the correct endpoint
7070
let eventForDispatch = getFirstEvent(dispatcher: eventDispatcher)!
71-
XCTAssertEqual(eventForDispatch.url.absoluteString, EventForDispatch.getEndpoint(for: .US))
71+
XCTAssertEqual(eventForDispatch.url.absoluteString, EventForDispatch.eventEndpoint)
7272
}
7373

7474
func testCreateImpressionEventWithEURegion() {
@@ -93,7 +93,7 @@ class BatchEventBuilderTests_Region: XCTestCase {
9393

9494
// Check if the event was sent to the correct endpoint
9595
let eventForDispatch = getFirstEvent(dispatcher: eventDispatcher)!
96-
XCTAssertEqual(eventForDispatch.url.absoluteString, EventForDispatch.getEndpoint(for: .EU))
96+
XCTAssertEqual(eventForDispatch.url.absoluteString, EventForDispatch.euEventEndpoint)
9797
}
9898

9999
func testCreateImpressionEventWithInvalidRegion() {
@@ -118,7 +118,7 @@ class BatchEventBuilderTests_Region: XCTestCase {
118118

119119
// Check if the event was sent to the correct endpoint
120120
let eventForDispatch = getFirstEvent(dispatcher: eventDispatcher)!
121-
XCTAssertEqual(eventForDispatch.url.absoluteString, EventForDispatch.getEndpoint(for: .US))
121+
XCTAssertEqual(eventForDispatch.url.absoluteString, EventForDispatch.eventEndpoint)
122122
}
123123

124124
// MARK: - Test Conversion Event with Region
@@ -143,7 +143,7 @@ class BatchEventBuilderTests_Region: XCTestCase {
143143

144144
// Check if the event was sent to the correct endpoint
145145
let eventForDispatch = getFirstEvent(dispatcher: eventDispatcher)!
146-
XCTAssertEqual(eventForDispatch.url.absoluteString, EventForDispatch.getEndpoint(for: .US))
146+
XCTAssertEqual(eventForDispatch.url.absoluteString, EventForDispatch.eventEndpoint)
147147
}
148148

149149
func testCreateConversionEventWithEURegion() {
@@ -166,7 +166,7 @@ class BatchEventBuilderTests_Region: XCTestCase {
166166

167167
// Check if the event was sent to the correct endpoint
168168
let eventForDispatch = getFirstEvent(dispatcher: eventDispatcher)!
169-
XCTAssertEqual(eventForDispatch.url.absoluteString, EventForDispatch.getEndpoint(for: .EU))
169+
XCTAssertEqual(eventForDispatch.url.absoluteString, EventForDispatch.euEventEndpoint)
170170
}
171171

172172
func testCreateConversionEventWithInvalidRegion() {
@@ -189,7 +189,7 @@ class BatchEventBuilderTests_Region: XCTestCase {
189189

190190
// Check if the event was sent to the correct endpoint
191191
let eventForDispatch = getFirstEvent(dispatcher: eventDispatcher)!
192-
XCTAssertEqual(eventForDispatch.url.absoluteString, EventForDispatch.getEndpoint(for: .US))
192+
XCTAssertEqual(eventForDispatch.url.absoluteString, EventForDispatch.eventEndpoint)
193193
}
194194

195195
// MARK: - Test Direct Event Creation with Region

0 commit comments

Comments
 (0)