mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Conform URL to ExpressibleByStringLiteral (#1214)
This commit is contained in:
@@ -47,8 +47,8 @@ class BugReportServiceTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testInitialStateWithRealService() throws {
|
||||
let service = BugReportService(withBaseURL: URL(staticString: "https://www.example.com"),
|
||||
sentryURL: URL(staticString: "https://1234@sentry.com/1234"),
|
||||
let service = BugReportService(withBaseURL: "https://www.example.com",
|
||||
sentryURL: "https://1234@sentry.com/1234",
|
||||
applicationId: "mock_app_id",
|
||||
maxUploadSize: ServiceLocator.shared.settings.bugReportMaxUploadSize,
|
||||
session: .mock)
|
||||
@@ -56,8 +56,8 @@ class BugReportServiceTests: XCTestCase {
|
||||
}
|
||||
|
||||
@MainActor func testSubmitBugReportWithRealService() async throws {
|
||||
let service = BugReportService(withBaseURL: URL(staticString: "https://www.example.com"),
|
||||
sentryURL: URL(staticString: "https://1234@sentry.com/1234"),
|
||||
let service = BugReportService(withBaseURL: "https://www.example.com",
|
||||
sentryURL: "https://1234@sentry.com/1234",
|
||||
applicationId: "mock_app_id",
|
||||
maxUploadSize: ServiceLocator.shared.settings.bugReportMaxUploadSize,
|
||||
session: .mock)
|
||||
|
||||
@@ -154,14 +154,14 @@ final class MediaProviderTests: XCTestCase {
|
||||
let expectedURL = URL(filePath: "/some/file/path")
|
||||
let expectedResult: Result<MediaFileHandleProxy, MediaProviderError> = .success(.unmanaged(url: expectedURL))
|
||||
mediaLoader.mediaFileURL = expectedURL
|
||||
let result = await mediaProvider.loadFileFromSource(MediaSourceProxy(url: URL(staticString: "test/test1"), mimeType: "video/mp4"))
|
||||
let result = await mediaProvider.loadFileFromSource(MediaSourceProxy(url: "test/test1", mimeType: "video/mp4"))
|
||||
XCTAssertEqual(result, expectedResult)
|
||||
}
|
||||
|
||||
func test_whenLoadFileFromSourceAndNoFileFromSourceExistsAndLoadContentSourceFails_failureIsReturned() async throws {
|
||||
let expectedResult: Result<MediaFileHandleProxy, MediaProviderError> = .failure(.failedRetrievingFile)
|
||||
mediaLoader.mediaFileURL = nil
|
||||
let result = await mediaProvider.loadFileFromSource(MediaSourceProxy(url: URL(staticString: "test/test1"), mimeType: "video/mp4"))
|
||||
let result = await mediaProvider.loadFileFromSource(MediaSourceProxy(url: "test/test1", mimeType: "video/mp4"))
|
||||
XCTAssertEqual(result, expectedResult)
|
||||
}
|
||||
|
||||
|
||||
@@ -108,19 +108,19 @@ class PermalinkBuilderTests: XCTestCase {
|
||||
}
|
||||
|
||||
func testPermalinkDetection() {
|
||||
var url = URL(staticString: "https://www.matrix.org")
|
||||
var url: URL = "https://www.matrix.org"
|
||||
XCTAssertEqual(PermalinkBuilder.detectPermalink(in: url, baseURL: appSettings.permalinkBaseURL), nil)
|
||||
|
||||
url = URL(staticString: "https://matrix.to/#/@bob:matrix.org?via=matrix.org")
|
||||
url = "https://matrix.to/#/@bob:matrix.org?via=matrix.org"
|
||||
XCTAssertEqual(PermalinkBuilder.detectPermalink(in: url, baseURL: appSettings.permalinkBaseURL), PermalinkType.userIdentifier("@bob:matrix.org"))
|
||||
|
||||
url = URL(staticString: "https://matrix.to/#/!roomidentifier:matrix.org?via=matrix.org")
|
||||
url = "https://matrix.to/#/!roomidentifier:matrix.org?via=matrix.org"
|
||||
XCTAssertEqual(PermalinkBuilder.detectPermalink(in: url, baseURL: appSettings.permalinkBaseURL), PermalinkType.roomIdentifier("!roomidentifier:matrix.org"))
|
||||
|
||||
url = URL(staticString: "https://matrix.to/#/%23roomalias:matrix.org?via=matrix.org")
|
||||
url = "https://matrix.to/#/%23roomalias:matrix.org?via=matrix.org"
|
||||
XCTAssertEqual(PermalinkBuilder.detectPermalink(in: url, baseURL: appSettings.permalinkBaseURL), PermalinkType.roomAlias("#roomalias:matrix.org"))
|
||||
|
||||
url = URL(staticString: "https://matrix.to/#/!roomidentifier:matrix.org/$eventidentifier?via=matrix.org")
|
||||
url = "https://matrix.to/#/!roomidentifier:matrix.org/$eventidentifier?via=matrix.org"
|
||||
XCTAssertEqual(PermalinkBuilder.detectPermalink(in: url, baseURL: appSettings.permalinkBaseURL), PermalinkType.event(roomIdentifier: "!roomidentifier:matrix.org", eventIdentifier: "$eventidentifier"))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user