1
0
mirror of https://github.com/metabolist/metatext synced 2024-12-12 01:16:46 +01:00
metatext-app-ios-iphone-ipad/ServiceLayer/Tests/ServiceLayerTests/InstanceURLServiceTests.swift
2021-01-28 17:14:34 -08:00

38 lines
1012 B
Swift

// Copyright © 2020 Metabolist. All rights reserved.
import CodableBloomFilter
import Combine
import CombineExpectations
@testable import ServiceLayer
@testable import ServiceLayerMocks
import Stubbing
import XCTest
final class InstanceURLServiceTests: XCTestCase {
func testFiltering() throws {
let sut = InstanceURLService(environment: .mock())
guard case .success = sut.url(text: "unfiltered.instance") else {
XCTFail("Expected success")
return
}
guard case let .failure(error) = sut.url(text: "filtered.instance"),
case InstanceURLError.instanceNotSupported = error
else {
XCTFail("Expected instance not supported error")
return
}
guard case .failure = sut.url(text: "subdomain.filtered.instance"),
case InstanceURLError.instanceNotSupported = error
else {
XCTFail("Expected instance not supported error")
return
}
}
}