Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor FXIOS-10145 - Update how we are tearing down our tests #22481

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ final class CrashManagerTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
sentryWrapper = nil
setupAppInformation(buildChannel: .other)
super.tearDown()
}

// MARK: - Setup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ final class LoggerFileManagerTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
subject = nil
fileManager = nil
super.tearDown()
}

func testExpectedLogDestination() throws {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ final class LoggerTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
beaverBuilder = nil
crashManager = nil
cleanUp()
super.tearDown()
}

// MARK: - Log
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ final class ContentBlockerGeneratorTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
self.fileManager = nil
self.parserData = nil
super.tearDown()
}

func testGenerator_whenEmptyFiles_generateNothing() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ final class ContentBlockerParserTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
self.parserData = nil
super.tearDown()
}

func testParsingAdsFile() throws {
Expand Down
2 changes: 1 addition & 1 deletion BrowserKit/Tests/ReduxTests/ReduxIntegrationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ final class ReduxIntegrationTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
fakeViewController = nil
super.tearDown()
}

func testDispatchStore_IncreaseCounter() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ class FaviconURLCacheTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
mockFileManager = nil
subject = nil
super.tearDown()
}

func testGetURLFromCacheWithEmptyCache() async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ class FaviconURLFetcherTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
networkMock = nil
subject = nil
super.tearDown()
}

func testGetFaviconWithExistingIcon() async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ class URLCacheFileManagerTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
mockFileManager = nil
subject = nil
super.tearDown()
}

func testGetURLCache() async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ final class FaviconFetcherTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
self.mockImageDownloader = nil
super.tearDown()
}

func testReturnsFailure_onAnyError() async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ final class HeroImageFetcherTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
self.metadataProvider = nil
super.tearDown()
}

func testHeroImageLoading_whenError_throwsError() async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ final class ImageHandlerTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
self.heroImageFetcher = nil
self.siteImageCache = nil
self.faviconFetcher = nil
self.letterImageGenerator = nil
super.tearDown()
}

// MARK: - Favicon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ final class SiteImageCacheTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
self.imageCache = nil
super.tearDown()
}

// MARK: - Get from cache
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ final class SiteImageHandlerTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
self.urlHandler = nil
self.imageHandler = nil
super.tearDown()
}

// MARK: - Favicon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ final class SiteImageViewTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
self.imageFetcher = nil
super.tearDown()
}

func testFaviconSetup() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ final class TabDataStoreTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
mockFileManager = nil
super.tearDown()
}

// MARK: - Saving Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ final class TabSessionStoreTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
mockFileManager = nil
super.tearDown()
}

// MARK: Save
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ final class AdsTelemetryContentScriptTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
adsTelemetryDelegate = nil
super.tearDown()
}

func testDidReceiveMessageGivenEmptyMessageThenNoDelegateCalled() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ final class FindInPageContentScriptTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
findInPageDelegate = nil
super.tearDown()
}

func testDidReceiveMessageGivenEmptyMessageThenNoDelegateCalled() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ final class MetadataFetcherHelperTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
metadataDelegate = nil
super.tearDown()
}

func testFetchFromSessionGivenNotWebpageURLThenPageMetadataNil() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ final class WKContentScriptManagerTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
script = nil
super.tearDown()
}

func testAddContentGivenAddedTwiceThenOnlyAddOnce() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ final class WKEngineSessionTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
configurationProvider = nil
webViewProvider = nil
contentScriptManager = nil
userScriptManager = nil
engineSessionDelegate = nil
findInPageDelegate = nil
metadataFetcher = nil
super.tearDown()
}

// MARK: Load URL
Expand Down
2 changes: 1 addition & 1 deletion BrowserKit/Tests/WebEngineTests/WKEngineTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ final class WKEngineTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
userScriptManager = nil
super.tearDown()
}

func testCreateViewThenCreatesView() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ final class AppFxACommandsTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
self.applicationStateProvider = nil
self.applicationHelper = nil
super.tearDown()
}

func testOpenSendTabs_inactiveState_doesntCallDeeplink() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ class FormAutofillHelperTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
profile = nil
DependencyHelperMock().reset()
tab = nil
Expand All @@ -87,6 +86,7 @@ class FormAutofillHelperTests: XCTestCase {
validPayloadCaptureMockWKMessage = nil
secureFrameMock = nil
secureWebviewMock = nil
super.tearDown()
}

// MARK: Parsing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ class BreachAlertsTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
breachAlertsManager = nil
super.tearDown()
}

func testDataRequest() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ final class BrowserViewControllerStateTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
DependencyHelperMock().reset()
super.tearDown()
}

func testAddNewTabAction() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ class CanRemoveQuickActionBookmarkTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
mockQuickActions = nil
mockBookmarksHandler = nil
subject = nil
super.tearDown()
}

func testWithoutBookmarks() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class ContextMenuHelperTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
profile = nil
AppContainer.shared.reset()
super.tearDown()
}

func testHistoryHighlightsTelemetry() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ final class BaseCoordinatorTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
navigationController = nil
router = nil
super.tearDown()
}

func testAddChild() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ final class DefaultRouterTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
navigationController = nil
super.tearDown()
}

func testInitialState() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ final class EnhancedTrackingProtectionCoordinatorTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
self.routeBuilder = nil
self.mockRouter = nil
self.profile = nil
self.tabManager = nil
self.glean = nil
self.delegate = nil
AppContainer.shared.reset()
super.tearDown()
}

func testParentCoordinatorDelegate_calledWithPage() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ final class FakespotCoordinatorTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
self.profile = nil
self.mockRouter = nil
AppContainer.shared.reset()
super.tearDown()
}

func testInitialState() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ final class LaunchCoordinatorTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
profile = nil
mockRouter = nil
delegate = nil
AppContainer.shared.reset()
super.tearDown()
}

func testInitialState() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ final class LaunchTypeTests: XCTestCase {
}

override func tearDown() {
super.tearDown()
AppContainer.shared.reset()
super.tearDown()
}

func testCanLaunch_surveyFromBrowserCoordinator() {
Expand Down
Loading