@@ -75,7 +75,7 @@ class SenseOfProtectionExperimentImplTest {
75
75
}
76
76
77
77
@Test
78
- fun `when user is new and experiment is enabled for user's cohort then isEnabled returns true ` () {
78
+ fun `when user is new and enrolUserInNewExperimentIfEligible then user is in enrolled ` () {
79
79
fakeUserBrowserProperties.setDaysSinceInstalled(28 )
80
80
fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentApr25().setRawStoredState(
81
81
State (
@@ -86,7 +86,9 @@ class SenseOfProtectionExperimentImplTest {
86
86
),
87
87
)
88
88
89
- assertTrue(testee.isEnabled(cohortName = MODIFIED_CONTROL ))
89
+ testee.enrolUserInNewExperimentIfEligible()
90
+
91
+ assertTrue(testee.enrolUserInNewExperimentIfEligible())
90
92
}
91
93
92
94
@Test
@@ -101,7 +103,7 @@ class SenseOfProtectionExperimentImplTest {
101
103
),
102
104
)
103
105
104
- assertFalse(testee.isEnabled( MODIFIED_CONTROL ))
106
+ assertFalse(testee.enrolUserInNewExperimentIfEligible( ))
105
107
}
106
108
107
109
@Test
@@ -116,53 +118,7 @@ class SenseOfProtectionExperimentImplTest {
116
118
),
117
119
)
118
120
119
- assertFalse(testee.isEnabled(MODIFIED_CONTROL ))
120
- }
121
-
122
- @Test
123
- fun `when user is existing and not enrolled in new user experiment then isEnabled returns true` () {
124
- fakeUserBrowserProperties.setDaysSinceInstalled(29 ) // just above threshold
125
- fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentApr25().setRawStoredState(
126
- State (
127
- remoteEnableState = true ,
128
- enable = true ,
129
- assignedCohort = null ,
130
- cohorts = cohorts,
131
- ),
132
- )
133
- fakeSenseOfProtectionToggles.senseOfProtectionExistingUserExperimentApr25().setRawStoredState(
134
- State (
135
- remoteEnableState = true ,
136
- enable = true ,
137
- assignedCohort = State .Cohort (MODIFIED_CONTROL .cohortName, weight = 1 ),
138
- cohorts = cohorts,
139
- ),
140
- )
141
-
142
- assertTrue(testee.isEnabled(MODIFIED_CONTROL ))
143
- }
144
-
145
- @Test
146
- fun `when user is existing and enrolled in existing user experiment but existing user experiment disabled then isEnabled returns false` () {
147
- fakeUserBrowserProperties.setDaysSinceInstalled(100 )
148
- fakeSenseOfProtectionToggles.senseOfProtectionNewUserExperimentApr25().setRawStoredState(
149
- State (
150
- remoteEnableState = true ,
151
- enable = true ,
152
- assignedCohort = null ,
153
- cohorts = cohorts,
154
- ),
155
- )
156
- fakeSenseOfProtectionToggles.senseOfProtectionExistingUserExperimentApr25().setRawStoredState(
157
- State (
158
- remoteEnableState = false ,
159
- enable = false ,
160
- assignedCohort = State .Cohort (MODIFIED_CONTROL .cohortName, weight = 1 ),
161
- cohorts = cohorts,
162
- ),
163
- )
164
-
165
- assertFalse(testee.isEnabled(MODIFIED_CONTROL ))
121
+ assertFalse(testee.enrolUserInNewExperimentIfEligible())
166
122
}
167
123
168
124
@Test
0 commit comments