Skip to content

Commit

Permalink
Test failure fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasstrba committed May 3, 2024
1 parent b14f651 commit 123952e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion DuckDuckGo/Application/DockPositionProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ enum DockApp: String, CaseIterable {
case arc = "/Applications/Arc.app/"
case safari = "/Applications/Safari.app/"
case safariLong = "/System/Volumes/Preboot/Cryptexes/App/System/Applications/Safari.app/"
case unknown = ""

var url: URL {
return URL(string: "file://" + self.rawValue)!
Expand Down
8 changes: 4 additions & 4 deletions UnitTests/App/DockPositionProviderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,24 @@ class DockPositionProviderTests: XCTestCase {

func testWhenAppDefaultBrowser_ThenIndexBasedOnThePrefferedOrder() {
mockBrowserProvider.isDefault = true
let currentApps = [DockApp.firefox.url, DockApp.edge.url, DockApp.safari.url]
let currentApps = [URL(string: "file:///Applications/Firefox.app/")!, URL(string: "file:///Applications/Unknown2.app/")!, URL(string: "file:///Applications/Unknown3.app/")!]
let index = provider.newDockIndex(from: currentApps)

XCTAssertEqual(index, 1, "The new app should be placed based on the order Preference - next To Firefox).")
}

func testWhenNotDefaultBrowser_ThenIndexIsNextToDefault() {
mockBrowserProvider.isDefault = false
mockBrowserProvider.defaultBrowserURL = DockApp.firefox.url
let currentApps = [DockApp.safari.url, DockApp.firefox.url, DockApp.arc.url]
mockBrowserProvider.defaultBrowserURL = URL(string: "file:///Applications/Firefox.app/")!
let currentApps = [URL(string: "file:///Applications/Safari.app/")!, URL(string: "file:///Applications/Firefox.app/")!, URL(string: "file:///Applications/Arc.app/")!]
let index = provider.newDockIndex(from: currentApps)

XCTAssertEqual(index, 2, "The new app should be placed next to default browser.")
}

func testWhenNotDefaultBrowserAndNoBrowserFound_ThenIndexIsTheEnd() {
mockBrowserProvider.isDefault = true
let currentApps = [URL(string: "file:///Applications/Unknown.app")!, URL(string: "file:///Applications/Unknown2.app")!, URL(string: "file:///Applications/Unknown3.app")!]
let currentApps = [URL(string: "file:///Applications/Unknown.app/")!, URL(string: "file:///Applications/Unknown2.app/")!, URL(string: "file:///Applications/Unknown3.app/")!]
let index = provider.newDockIndex(from: currentApps)

XCTAssertEqual(index, 3, "The new app should be placed at the end.")
Expand Down

0 comments on commit 123952e

Please sign in to comment.