From 60689d597c38adba19c2ef4982f0831a88002212 Mon Sep 17 00:00:00 2001 From: bwaresiak Date: Wed, 20 Sep 2023 09:43:35 +0200 Subject: [PATCH] Update Fire Button ref tests (#1987) --- Core/FileLoader.swift | 7 ++++++- DuckDuckGoTests/FireButtonReferenceTests.swift | 7 ++++++- submodules/privacy-reference-tests | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Core/FileLoader.swift b/Core/FileLoader.swift index 2c854aa795..d775e6386a 100644 --- a/Core/FileLoader.swift +++ b/Core/FileLoader.swift @@ -32,7 +32,12 @@ class FileLoader { let baseName = fileUrl.deletingPathExtension().path let ext = fileUrl.pathExtension - guard let path = bundle.path(forResource: baseName, ofType: ext) else { throw FileError.unknownFile } + var path = bundle.path(forResource: baseName, ofType: ext) + if path == nil { + let fileName = fileName.dropping(suffix: ext).dropping(suffix: ".") + path = bundle.path(forResource: fileName, ofType: ext) + } + guard let path else { throw FileError.unknownFile } let url = URL(fileURLWithPath: path) guard let data = try? Data(contentsOf: url, options: [.mappedIfSafe]) else { throw FileError.invalidFileContents } return data diff --git a/DuckDuckGoTests/FireButtonReferenceTests.swift b/DuckDuckGoTests/FireButtonReferenceTests.swift index 34d799043d..025167b8cf 100644 --- a/DuckDuckGoTests/FireButtonReferenceTests.swift +++ b/DuckDuckGoTests/FireButtonReferenceTests.swift @@ -51,7 +51,12 @@ final class FireButtonReferenceTests: XCTestCase { } private func sanitizedSite(_ site: String) -> String { - let url = URL(string: site)! + let url: URL + if site.hasPrefix("http") { + url = URL(string: site)! + } else { + url = URL(string: "https://" + site)! + } return url.host! } diff --git a/submodules/privacy-reference-tests b/submodules/privacy-reference-tests index 3c04aa5980..0d23f76801 160000 --- a/submodules/privacy-reference-tests +++ b/submodules/privacy-reference-tests @@ -1 +1 @@ -Subproject commit 3c04aa5980539ba2852584d202d2b67c1ff32643 +Subproject commit 0d23f76801c2e73ae7d5ed7daa4af4aca5beec73