This commit is contained in:
Benoit Marty 2023-03-16 09:47:45 +01:00
parent 6a3f5a50d9
commit 7857339f54
1 changed files with 6 additions and 0 deletions

View File

@ -80,6 +80,12 @@ class DefaultVectorAnalyticsTest {
@Test @Test
fun `when revoking consent to analytics then updates posthog opt out to true and closes Sentry`() = runTest { fun `when revoking consent to analytics then updates posthog opt out to true and closes Sentry`() = runTest {
// For opt-out to have effect on Posthog, it has to be used first, so it has to be opt-in first
fakeAnalyticsStore.givenUserContent(consent = true)
fakePostHog.verifyOptOutStatus(optedOut = false)
fakeSentryAnalytics.verifySentryInit()
// Then test opt-out
fakeAnalyticsStore.givenUserContent(consent = false) fakeAnalyticsStore.givenUserContent(consent = false)
fakePostHog.verifyOptOutStatus(optedOut = true) fakePostHog.verifyOptOutStatus(optedOut = true)