@@ -313,6 +313,61 @@ final class SettingsViewModelTests: XCTestCase {
313313 XCTAssertFalse ( viewModel. sections. contains { $0. rows. contains ( SettingsViewController . Row. whatsNew) } )
314314 }
315315
316+ func test_sections_does_not_contain_notifications_row_when_feature_flag_is_disabled( ) {
317+ // Given
318+ let featureFlagService = MockFeatureFlagService ( notificationSettings: false )
319+ let testSite = Site . fake ( ) . copy ( siteID: 123 , isJetpackThePluginInstalled: true , isJetpackConnected: true )
320+ let stores = MockStoresManager ( sessionManager: . makeForTesting( authenticated: true , isWPCom: true , defaultSite: testSite) )
321+ let viewModel = SettingsViewModel ( stores: stores, featureFlagService: featureFlagService)
322+
323+ // When
324+ viewModel. onViewDidLoad ( )
325+
326+ // Then
327+ XCTAssertFalse ( viewModel. sections. contains { $0. rows. contains ( SettingsViewController . Row. notifications) } )
328+ }
329+
330+ func test_sections_does_not_contain_notifications_row_when_user_is_authenticated_without_WPCom( ) {
331+ // Given
332+ let featureFlagService = MockFeatureFlagService ( notificationSettings: true )
333+ let testSite = Site . fake ( ) . copy ( siteID: 123 , isJetpackThePluginInstalled: true , isJetpackConnected: true )
334+ let stores = MockStoresManager ( sessionManager: . makeForTesting( authenticated: true , isWPCom: false , defaultSite: testSite) )
335+ let viewModel = SettingsViewModel ( stores: stores, featureFlagService: featureFlagService)
336+
337+ // When
338+ viewModel. onViewDidLoad ( )
339+
340+ // Then
341+ XCTAssertFalse ( viewModel. sections. contains { $0. rows. contains ( SettingsViewController . Row. notifications) } )
342+ }
343+
344+ func test_sections_does_not_contain_notifications_row_when_site_is_JCP( ) {
345+ // Given
346+ let featureFlagService = MockFeatureFlagService ( notificationSettings: true )
347+ let testSite = Site . fake ( ) . copy ( siteID: 123 , isJetpackThePluginInstalled: false , isJetpackConnected: true )
348+ let stores = MockStoresManager ( sessionManager: . makeForTesting( authenticated: true , isWPCom: true , defaultSite: testSite) )
349+ let viewModel = SettingsViewModel ( stores: stores, featureFlagService: featureFlagService)
350+
351+ // When
352+ viewModel. onViewDidLoad ( )
353+
354+ // Then
355+ XCTAssertFalse ( viewModel. sections. contains { $0. rows. contains ( SettingsViewController . Row. notifications) } )
356+ }
357+
358+ func test_sections_does_not_contain_notifications_row_for_Jetpack_site_and_user_is_authenticated_with_WPCom( ) {
359+ // Given
360+ let featureFlagService = MockFeatureFlagService ( notificationSettings: true )
361+ let testSite = Site . fake ( ) . copy ( siteID: 123 , isJetpackThePluginInstalled: true , isJetpackConnected: true )
362+ let stores = MockStoresManager ( sessionManager: . makeForTesting( authenticated: true , isWPCom: true , defaultSite: testSite) )
363+ let viewModel = SettingsViewModel ( stores: stores, featureFlagService: featureFlagService)
364+
365+ // When
366+ viewModel. onViewDidLoad ( )
367+
368+ // Then
369+ XCTAssertTrue ( viewModel. sections. contains { $0. rows. contains ( SettingsViewController . Row. notifications) } )
370+ }
316371}
317372
318373private final class MockSettingsPresenter : SettingsViewPresenter {
0 commit comments