Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mallexxx committed Oct 12, 2023
1 parent 491a801 commit fb55c63
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions UnitTests/DataImport/BrowserProfileTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class BrowserProfileListTests: XCTestCase {
let fileStore = FileStoreMock()
let profile = DataImport.BrowserProfile(browser: .firefox, profileURL: profileURL, fileStore: fileStore)

XCTAssertFalse(profile.hasBrowserData)
XCTAssertTrue(profile.validateProfileData()?.containsValidData == false)
}

func testWhenBrowserProfileHasURLWithChromiumLoginData_ThenHasLoginDataIsTrue() {
Expand All @@ -39,7 +39,7 @@ class BrowserProfileListTests: XCTestCase {

fileStore.directoryStorage[profileURL.absoluteString] = ["Login Data"]

XCTAssertTrue(profile.hasBrowserData)
XCTAssertTrue(profile.validateProfileData()?.containsValidData == true)
}

func testWhenBrowserProfileHasURLWithFirefoxLoginData_ThenHasLoginDataIsTrue() {
Expand All @@ -48,13 +48,13 @@ class BrowserProfileListTests: XCTestCase {
let profile = DataImport.BrowserProfile(browser: .firefox, profileURL: profileURL, fileStore: fileStore)

fileStore.directoryStorage[profileURL.absoluteString] = ["key4.db"]
XCTAssertFalse(profile.hasBrowserData)
XCTAssertTrue(profile.validateProfileData()?.containsValidData == false)

fileStore.directoryStorage[profileURL.absoluteString] = ["logins.json"]
XCTAssertFalse(profile.hasBrowserData)
XCTAssertTrue(profile.validateProfileData()?.containsValidData == false)

fileStore.directoryStorage[profileURL.absoluteString] = ["logins.json", "key4.db"]
XCTAssertTrue(profile.hasBrowserData)
XCTAssertTrue(profile.validateProfileData()?.containsValidData == true)
}

func testWhenGettingProfileName_AndProfileHasNoDetectedName_ThenTheDirectoryNameIsUsed() {
Expand Down
8 changes: 4 additions & 4 deletions UnitTests/DataImport/ThirdPartyBrowserTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ class ThirdPartyBrowserTests: XCTestCase {
let mockApplicationSupportDirectoryURL = FileManager.default.temporaryDirectory.appendingPathComponent(mockApplicationSupportDirectoryName)
try mockApplicationSupportDirectory.writeToTemporaryDirectory()

guard let list = ThirdPartyBrowser.firefox.browserProfiles(supportDirectoryURL: mockApplicationSupportDirectoryURL) else {
guard let list = ThirdPartyBrowser.firefox.browserProfiles(applicationSupportURL: mockApplicationSupportDirectoryURL) else {
XCTFail("Failed to get profile list")
return
}

let validProfiles = list.profiles.filter { $0.hasBrowserData }
let validProfiles = list.profiles.filter { $0.validateProfileData()?.containsValidData == true }
XCTAssertEqual(validProfiles.count, 2)
XCTAssertEqual(list.defaultProfile?.profileName, "default-release")
}
Expand All @@ -102,12 +102,12 @@ class ThirdPartyBrowserTests: XCTestCase {
let mockApplicationSupportDirectoryURL = FileManager.default.temporaryDirectory.appendingPathComponent(mockApplicationSupportDirectoryName)
try mockApplicationSupportDirectory.writeToTemporaryDirectory()

guard let list = ThirdPartyBrowser.firefox.browserProfiles(supportDirectoryURL: mockApplicationSupportDirectoryURL) else {
guard let list = ThirdPartyBrowser.firefox.browserProfiles(applicationSupportURL: mockApplicationSupportDirectoryURL) else {
XCTFail("Failed to get profile list")
return
}

let validProfiles = list.profiles.filter { $0.hasBrowserData }
let validProfiles = list.profiles.filter { $0.validateProfileData()?.containsValidData == true }
XCTAssertEqual(validProfiles.count, 1)
XCTAssertEqual(list.defaultProfile?.profileName, "default-release")
}
Expand Down

0 comments on commit fb55c63

Please sign in to comment.