Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Commit

Permalink
Add AppSplashController to tests (#1127)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviabrown9 authored Jul 18, 2018
1 parent f14794c commit 4abaa41
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions ClientTests/BrowserViewControllerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@ import XCTest
class BrowserViewControllerTests: XCTestCase {
private let mockUserDefaults = MockUserDefaults()

class TestAppSplashController: AppSplashController {
var splashView = UIView()
func toggleSplashView(hide: Bool) {}
}

func testRequestReviewThreshold() {
let bvc = BrowserViewController()
let bvc = BrowserViewController(appSplashController: TestAppSplashController())
mockUserDefaults.clear()

// Ensure initial threshold is set
Expand Down Expand Up @@ -50,7 +55,7 @@ class BrowserViewControllerTests: XCTestCase {
}

func testShareButtonPreviouslyInGroup() {
let bvc = BrowserViewController()
let bvc = BrowserViewController(appSplashController: TestAppSplashController())
mockUserDefaults.clear()
mockUserDefaults.set(10, forKey: BrowserViewController.userDefaultsTrackersBlockedKey)
mockUserDefaults.set(true, forKey: BrowserViewController.userDefaultsShareTrackerStatsKeyOLD)
Expand All @@ -61,7 +66,7 @@ class BrowserViewControllerTests: XCTestCase {
}

func testShareButtonPreviouslyOutGroup() {
let bvc = BrowserViewController()
let bvc = BrowserViewController(appSplashController: TestAppSplashController())
mockUserDefaults.clear()
mockUserDefaults.set(10, forKey: BrowserViewController.userDefaultsTrackersBlockedKey)
mockUserDefaults.set(false, forKey: BrowserViewController.userDefaultsShareTrackerStatsKeyOLD)
Expand All @@ -71,7 +76,7 @@ class BrowserViewControllerTests: XCTestCase {
}

func testShareButtonHasNotHitEnoughTrackers() {
let bvc = BrowserViewController()
let bvc = BrowserViewController(appSplashController: TestAppSplashController())
mockUserDefaults.clear()
mockUserDefaults.set(9, forKey: BrowserViewController.userDefaultsTrackersBlockedKey)

Expand All @@ -80,7 +85,7 @@ class BrowserViewControllerTests: XCTestCase {
}

func testShareButtonInGroup() {
let bvc = BrowserViewController()
let bvc = BrowserViewController(appSplashController: TestAppSplashController())
mockUserDefaults.clear()
mockUserDefaults.set(10, forKey: BrowserViewController.userDefaultsTrackersBlockedKey)
mockUserDefaults.set(true, forKey: BrowserViewController.userDefaultsShareTrackerStatsKeyNEW)
Expand All @@ -90,7 +95,7 @@ class BrowserViewControllerTests: XCTestCase {
}

func testShareButtonOutGroup() {
let bvc = BrowserViewController()
let bvc = BrowserViewController(appSplashController: TestAppSplashController())
mockUserDefaults.clear()
mockUserDefaults.set(10, forKey: BrowserViewController.userDefaultsTrackersBlockedKey)
mockUserDefaults.set(false, forKey: BrowserViewController.userDefaultsShareTrackerStatsKeyNEW)
Expand Down

0 comments on commit 4abaa41

Please sign in to comment.