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

Commit

Permalink
Fix #3700: Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cuba committed Mar 15, 2022
1 parent 661af7e commit 7118f6e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
27 changes: 22 additions & 5 deletions ClientTests/DomainUserScriptTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ class DomainUserScriptTests: XCTestCase {
URL(string: "https://search-dev.brave.com/custom/path")].compactMap { $0 }

goodURLs.forEach {
XCTAssert(DomainUserScript.get(for: $0) == .braveSearch)
XCTAssertEqual(DomainUserScript(for: $0), .braveSearchHelper)
}

let badURLs = [URL(string: "https://talk.brave.com"),
URL(string: "https://search.brave.software.com"),
URL(string: "https://search.brave.software.com"),
URL(string: "https://community.brave.com"),
URL(string: "https://subdomain.search.brave.com"),
URL(string: "https://brave.com")].compactMap { $0 }

badURLs.forEach {
XCTAssertFalse(DomainUserScript.get(for: $0) == .braveSearch)
XCTAssertNotEqual(DomainUserScript(for: $0), .braveSearchHelper)
}
}

Expand All @@ -40,7 +40,7 @@ class DomainUserScriptTests: XCTestCase {
URL(string: "https://talk.brave.com/account")].compactMap { $0 }

goodURLs.forEach {
XCTAssert(DomainUserScript.get(for: $0) == .braveTalk)
XCTAssertEqual(DomainUserScript(for: $0), .braveTalkHelper)
}

let badURLs = [URL(string: "https://search.brave.com"),
Expand All @@ -52,7 +52,24 @@ class DomainUserScriptTests: XCTestCase {
URL(string: "https://brave.com")].compactMap { $0 }

badURLs.forEach {
XCTAssertFalse(DomainUserScript.get(for: $0) == .braveTalk)
XCTAssertNotEqual(DomainUserScript(for: $0), .braveTalkHelper)
}
}

func testYouTubeAdBlockAvailability() throws {
let goodURLs = [URL(string: "https://youtube.com")!,
URL(string: "https://www.youtube.com")!]

goodURLs.forEach {
XCTAssertEqual(DomainUserScript(for: $0), .youtubeAdBlock)
}

let badURLs = [URL(string: "https://youtube.org.com")!,
URL(string: "https://www.youtube.org.com")!,
URL(string: "https://metube.com")!]

badURLs.forEach {
XCTAssertNotEqual(DomainUserScript(for: $0), .youtubeAdBlock)
}
}
}
2 changes: 1 addition & 1 deletion ClientTests/TabSessionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ class TabSessionTests: XCTestCase {
let group = DispatchGroup()
for tab in self.tabManager.allTabs {
// include all scripts
tab.userScriptManager?.isFingerprintingProtectionEnabled = true
tab.userScriptManager?.domainScriptTypes = [.farblingProtection(etld: "fake.com")]
tab.userScriptManager?.isCookieBlockingEnabled = true

group.enter()
Expand Down

0 comments on commit 7118f6e

Please sign in to comment.