Skip to content

Commit

Permalink
Rename OneSignalImplTests.kt -> OneSignalImpTests
Browse files Browse the repository at this point in the history
Fix linting errors with OneSignalImp and OneSignalImpTests
  • Loading branch information
brismithers committed Nov 14, 2023
1 parent 0212f11 commit f89a829
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,11 @@ internal class OneSignalImp : IOneSignal, IServiceProvider {
startupService!!.bootstrap()

if (forceCreateUser || !identityModelStore!!.model.hasProperty(IdentityConstants.ONESIGNAL_ID)) {
val legacyPlayerId = preferencesService!!.getString(
PreferenceStores.ONESIGNAL,
PreferenceOneSignalKeys.PREFS_LEGACY_PLAYER_ID
)
val legacyPlayerId =
preferencesService!!.getString(
PreferenceStores.ONESIGNAL,
PreferenceOneSignalKeys.PREFS_LEGACY_PLAYER_ID,
)
if (legacyPlayerId == null) {
Logging.debug("initWithContext: creating new device-scoped user")
createAndSwitchToNewUser()
Expand Down Expand Up @@ -293,7 +294,7 @@ internal class OneSignalImp : IOneSignal, IServiceProvider {
configModel!!.pushSubscriptionId = legacyPlayerId
subscriptionModelStore!!.add(
pushSubscriptionModel,
ModelChangeTags.NO_PROPOGATE
ModelChangeTags.NO_PROPOGATE,
)
suppressBackendOperation = true
}
Expand All @@ -304,22 +305,22 @@ internal class OneSignalImp : IOneSignal, IServiceProvider {
LoginUserFromSubscriptionOperation(
configModel!!.appId,
identityModelStore!!.model.onesignalId,
legacyPlayerId
legacyPlayerId,
),
)
preferencesService!!.saveString(
PreferenceStores.ONESIGNAL,
PreferenceOneSignalKeys.PREFS_LEGACY_PLAYER_ID,
null
null,
)
}
} else {
Logging.debug("initWithContext: using cached user ${identityModelStore!!.model.onesignalId}")
operationRepo!!.enqueue(
RefreshUserOperation(
configModel!!.appId,
identityModelStore!!.model.onesignalId
)
identityModelStore!!.model.onesignalId,
),
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import io.kotest.runner.junit4.KotestTestRunner
import org.junit.runner.RunWith

@RunWith(KotestTestRunner::class)
class OneSignalImplTests : FunSpec({
class OneSignalImpTests : FunSpec({
beforeAny {
Logging.logLevel = LogLevel.NONE
}
Expand All @@ -19,9 +19,10 @@ class OneSignalImplTests : FunSpec({
val os = OneSignalImp()

// When
val exception = shouldThrowUnit<Exception> {
os.login("login-id")
}
val exception =
shouldThrowUnit<Exception> {
os.login("login-id")
}

// Then
exception.message shouldBe "Must call 'initWithContext' before 'login'"
Expand All @@ -32,9 +33,10 @@ class OneSignalImplTests : FunSpec({
val os = OneSignalImp()

// When
val exception = shouldThrowUnit<Exception> {
os.logout()
}
val exception =
shouldThrowUnit<Exception> {
os.logout()
}

// Then
exception.message shouldBe "Must call 'initWithContext' before 'logout'"
Expand Down

0 comments on commit f89a829

Please sign in to comment.