Skip to content

Commit

Permalink
ref
Browse files Browse the repository at this point in the history
  • Loading branch information
marandaneto committed Sep 11, 2024
1 parent cadce25 commit 2f547a7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 26 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Next

- chore: add personProfiles support ([#171](https://github.com/PostHog/posthog-android/pull/171))

## 3.6.1 - 2024-08-30

- fix: do not clear events when reset is called ([#170](https://github.com/PostHog/posthog-android/pull/170))
Expand Down
41 changes: 15 additions & 26 deletions posthog/src/test/java/com/posthog/PostHogPersonProfilesTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,17 @@ internal class PostHogPersonProfilesTest {
host: String,
flushAt: Int = 1,
storagePrefix: String = tmpDir.newFolder().absolutePath,
optOut: Boolean = false,
preloadFeatureFlags: Boolean = true,
reloadFeatureFlags: Boolean = true,
sendFeatureFlagEvent: Boolean = true,
integration: PostHogIntegration? = null,
cachePreferences: PostHogMemoryPreferences = PostHogMemoryPreferences(),
propertiesSanitizer: PostHogPropertiesSanitizer? = null,
personProfiles: PersonProfiles? = PersonProfiles.IDENTIFIED_ONLY,
): PostHogInterface {
config =
PostHogConfig(API_KEY, host).apply {
// for testing
this.flushAt = flushAt
this.storagePrefix = storagePrefix
this.optOut = optOut
this.preloadFeatureFlags = preloadFeatureFlags
if (integration != null) {
addIntegration(integration)
}
this.sendFeatureFlagEvent = sendFeatureFlagEvent
this.preloadFeatureFlags = false
this.sendFeatureFlagEvent = false
this.cachePreferences = cachePreferences
this.propertiesSanitizer = propertiesSanitizer
if (personProfiles != null) {
this.personProfiles = personProfiles
}
Expand All @@ -60,7 +49,7 @@ internal class PostHogPersonProfilesTest {
replayQueueExecutor,
featureFlagsExecutor,
cachedEventsExecutor,
reloadFeatureFlags,
false,
)
}

Expand All @@ -74,7 +63,7 @@ internal class PostHogPersonProfilesTest {
val http = mockHttp()
val url = http.url("/")

val sut = getSut(url.toString(), preloadFeatureFlags = false, reloadFeatureFlags = false)
val sut = getSut(url.toString())

sut.identify(
DISTINCT_ID,
Expand Down Expand Up @@ -107,7 +96,7 @@ internal class PostHogPersonProfilesTest {
val http = mockHttp()
val url = http.url("/")

val sut = getSut(url.toString(), preloadFeatureFlags = false, reloadFeatureFlags = false)
val sut = getSut(url.toString())

sut.capture("test event")

Expand All @@ -130,7 +119,7 @@ internal class PostHogPersonProfilesTest {
val http = mockHttp()
val url = http.url("/")

val sut = getSut(url.toString(), preloadFeatureFlags = false, reloadFeatureFlags = false)
val sut = getSut(url.toString())

sut.capture(
"test event",
Expand All @@ -155,7 +144,7 @@ internal class PostHogPersonProfilesTest {
val http = mockHttp()
val url = http.url("/")

val sut = getSut(url.toString(), preloadFeatureFlags = false, reloadFeatureFlags = false)
val sut = getSut(url.toString())

sut.capture(
"test event",
Expand All @@ -180,7 +169,7 @@ internal class PostHogPersonProfilesTest {
val http = mockHttp()
val url = http.url("/")

val sut = getSut(url.toString(), preloadFeatureFlags = false, reloadFeatureFlags = false)
val sut = getSut(url.toString())

sut.capture(
"test event",
Expand All @@ -205,7 +194,7 @@ internal class PostHogPersonProfilesTest {
val http = mockHttp()
val url = http.url("/")

val sut = getSut(url.toString(), flushAt = 2, preloadFeatureFlags = false, reloadFeatureFlags = false)
val sut = getSut(url.toString(), flushAt = 2)

sut.identify("distinctId")

Expand All @@ -229,7 +218,7 @@ internal class PostHogPersonProfilesTest {
val http = mockHttp()
val url = http.url("/")

val sut = getSut(url.toString(), flushAt = 2, preloadFeatureFlags = false, reloadFeatureFlags = false)
val sut = getSut(url.toString(), flushAt = 2)

sut.alias("distinctId")

Expand All @@ -253,7 +242,7 @@ internal class PostHogPersonProfilesTest {
val http = mockHttp()
val url = http.url("/")

val sut = getSut(url.toString(), flushAt = 2, preloadFeatureFlags = false, reloadFeatureFlags = false)
val sut = getSut(url.toString(), flushAt = 2)

sut.group("theType", "theKey")

Expand All @@ -278,7 +267,7 @@ internal class PostHogPersonProfilesTest {
val http = mockHttp()
val url = http.url("/")

val sut = getSut(url.toString(), preloadFeatureFlags = false, reloadFeatureFlags = false, personProfiles = PersonProfiles.ALWAYS)
val sut = getSut(url.toString(), personProfiles = PersonProfiles.ALWAYS)

sut.capture("test event")

Expand All @@ -301,7 +290,7 @@ internal class PostHogPersonProfilesTest {
val http = mockHttp()
val url = http.url("/")

val sut = getSut(url.toString(), preloadFeatureFlags = false, reloadFeatureFlags = false, personProfiles = PersonProfiles.NEVER)
val sut = getSut(url.toString(), personProfiles = PersonProfiles.NEVER)

sut.identify("distinctId")

Expand All @@ -326,7 +315,7 @@ internal class PostHogPersonProfilesTest {
val http = mockHttp()
val url = http.url("/")

val sut = getSut(url.toString(), preloadFeatureFlags = false, reloadFeatureFlags = false, personProfiles = PersonProfiles.NEVER)
val sut = getSut(url.toString(), personProfiles = PersonProfiles.NEVER)

sut.alias("distinctId")

Expand All @@ -351,7 +340,7 @@ internal class PostHogPersonProfilesTest {
val http = mockHttp()
val url = http.url("/")

val sut = getSut(url.toString(), preloadFeatureFlags = false, reloadFeatureFlags = false, personProfiles = PersonProfiles.NEVER)
val sut = getSut(url.toString(), personProfiles = PersonProfiles.NEVER)

sut.group("theType", "theKey")

Expand Down

0 comments on commit 2f547a7

Please sign in to comment.