Skip to content

Commit

Permalink
add OneSignal-Install-Id test to HttpClientTest
Browse files Browse the repository at this point in the history
  • Loading branch information
jkasten2 committed May 3, 2024
1 parent 40bd472 commit 6ed8b4d
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ class Mocks {
internal val mockConfigModel = MockHelper.configModelStore()
internal val response = MockHttpConnectionFactory.MockResponse()
internal val factory = MockHttpConnectionFactory(response)
internal val installIdService = InstallIdService(MockPreferencesService())
internal val httpClient by lazy {
HttpClient(factory, MockPreferencesService(), mockConfigModel, Time(), InstallIdService(MockPreferencesService()))
HttpClient(factory, MockPreferencesService(), mockConfigModel, Time(), installIdService)
}
}

Expand Down Expand Up @@ -51,7 +52,7 @@ class HttpClientTests : FunSpec({
response.throwable should beInstanceOf<TimeoutCancellationException>()
}

test("SDKHeader is included in all requests") {
test("SDK Headers are included in all requests") {
// Given
val mocks = Mocks()
val httpClient = mocks.httpClient
Expand All @@ -66,6 +67,7 @@ class HttpClientTests : FunSpec({
// Then
for (connection in mocks.factory.connections) {
connection.getRequestProperty("SDK-Version") shouldBe "onesignal/android/${OneSignalUtils.SDK_VERSION}"
connection.getRequestProperty("OneSignal-Install-Id") shouldBe mocks.installIdService.getId().toString()
}
}

Expand Down

0 comments on commit 6ed8b4d

Please sign in to comment.