@@ -77,14 +77,17 @@ async function waitForEndpointToBeCalled(
7777}
7878
7979describe ( 'Profile Metrics' , function ( ) {
80- describe ( 'when MetaMetrics is enabled and the feature flag is on' , function ( ) {
80+ describe ( 'when MetaMetrics is enabled, the feature flag is on, and the user acknoledged the privacy change ' , function ( ) {
8181 it ( 'sends exising accounts to the API on wallet unlock after activating MetaMetrics' , async function ( ) {
8282 await withFixtures (
8383 {
8484 fixtures : new FixtureBuilder ( )
8585 . withMetaMetricsController ( {
8686 participateInMetaMetrics : true ,
8787 } )
88+ . withAppStateController ( {
89+ pna25Acknowledged : true ,
90+ } )
8891 . build ( ) ,
8992 testSpecificMock : async ( server : Mockttp ) => [
9093 await mockAuthService ( server ) ,
@@ -121,6 +124,9 @@ describe('Profile Metrics', function () {
121124 . withMetaMetricsController ( {
122125 participateInMetaMetrics : true ,
123126 } )
127+ . withAppStateController ( {
128+ pna25Acknowledged : true ,
129+ } )
124130 . build ( ) ,
125131 testSpecificMock : async ( server : Mockttp ) => [
126132 await mockAuthService ( server ) ,
@@ -159,77 +165,67 @@ describe('Profile Metrics', function () {
159165 } ) ;
160166 } ) ;
161167
162- describe ( 'when MetaMetrics is disabled or the feature flag is off' , function ( ) {
163- it ( 'does not send existing accounts to the API on wallet unlock if MetaMetrics is disabled' , async function ( ) {
164- await withFixtures (
165- {
166- fixtures : new FixtureBuilder ( )
167- . withMetaMetricsController ( {
168- participateInMetaMetrics : false ,
169- } )
170- . build ( ) ,
171- testSpecificMock : async ( server : Mockttp ) => [
172- await mockAuthService ( server ) ,
173- await mockSendFeatureFlag ( true ) ( server ) ,
174- ] ,
175- title : this . test ?. fullTitle ( ) ,
176- } ,
177- async ( {
178- driver,
179- mockedEndpoint,
180- } : {
181- driver : Driver ;
182- mockedEndpoint : MockedEndpoint [ ] ;
183- } ) => {
184- await loginWithBalanceValidation ( driver ) ;
185-
186- await driver . delay ( 5000 ) ;
187-
188- const [ authCall ] = mockedEndpoint ;
189- const requests = await authCall . getSeenRequests ( ) ;
190- assert . equal (
191- requests . length ,
192- 0 ,
193- 'Expected no requests to the auth API.' ,
168+ [
169+ {
170+ title : 'MetaMetrics is disabled' ,
171+ participateInMetaMetrics : false ,
172+ featureFlag : true ,
173+ pna25Acknowledged : true ,
174+ } ,
175+ {
176+ title : 'feature flag is off' ,
177+ participateInMetaMetrics : true ,
178+ featureFlag : false ,
179+ pna25Acknowledged : true ,
180+ } ,
181+ {
182+ title : 'user has not acknowledged the privacy change' ,
183+ participateInMetaMetrics : true ,
184+ featureFlag : true ,
185+ pna25Acknowledged : false ,
186+ } ,
187+ ] . forEach (
188+ ( { title, participateInMetaMetrics, featureFlag, pna25Acknowledged } ) => {
189+ describe ( title , function ( ) {
190+ it ( 'does not send existing accounts to the API on wallet unlock' , async function ( ) {
191+ await withFixtures (
192+ {
193+ fixtures : new FixtureBuilder ( )
194+ . withMetaMetricsController ( {
195+ participateInMetaMetrics,
196+ } )
197+ . withAppStateController ( {
198+ pna25Acknowledged,
199+ } )
200+ . build ( ) ,
201+ testSpecificMock : async ( server : Mockttp ) => [
202+ await mockAuthService ( server ) ,
203+ await mockSendFeatureFlag ( featureFlag ) ( server ) ,
204+ ] ,
205+ title : this . test ?. fullTitle ( ) ,
206+ } ,
207+ async ( {
208+ driver,
209+ mockedEndpoint,
210+ } : {
211+ driver : Driver ;
212+ mockedEndpoint : MockedEndpoint [ ] ;
213+ } ) => {
214+ await loginWithBalanceValidation ( driver ) ;
215+
216+ await driver . delay ( 5000 ) ;
217+
218+ const [ authCall ] = mockedEndpoint ;
219+ const requests = await authCall . getSeenRequests ( ) ;
220+ assert . equal (
221+ requests . length ,
222+ 0 ,
223+ 'Expected no requests to the auth API.' ,
224+ ) ;
225+ } ,
194226 ) ;
195- } ,
196- ) ;
197- } ) ;
198-
199- it ( 'does not send existing accounts to the API on wallet unlock if feature flag is disabled' , async function ( ) {
200- await withFixtures (
201- {
202- fixtures : new FixtureBuilder ( )
203- . withMetaMetricsController ( {
204- participateInMetaMetrics : true ,
205- } )
206- . build ( ) ,
207- testSpecificMock : async ( server : Mockttp ) => [
208- await mockAuthService ( server ) ,
209- await mockSendFeatureFlag ( false ) ( server ) ,
210- ] ,
211- title : this . test ?. fullTitle ( ) ,
212- } ,
213- async ( {
214- driver,
215- mockedEndpoint,
216- } : {
217- driver : Driver ;
218- mockedEndpoint : MockedEndpoint [ ] ;
219- } ) => {
220- await loginWithBalanceValidation ( driver ) ;
221-
222- await driver . delay ( 5000 ) ;
223-
224- const [ authCall ] = mockedEndpoint ;
225- const requests = await authCall . getSeenRequests ( ) ;
226- assert . equal (
227- requests . length ,
228- 0 ,
229- 'Expected no requests to the auth API.' ,
230- ) ;
231- } ,
232- ) ;
233- } ) ;
234- } ) ;
227+ } ) ;
228+ } ) ;
229+ } ,
230+ ) ;
235231} ) ;
0 commit comments