mirror of
https://github.com/metabolist/metatext.git
synced 2024-12-22 05:26:30 +00:00
37 lines
1,012 B
Swift
37 lines
1,012 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
|
|
}
|
|
}
|
|
}
|