1
0
mirror of https://github.com/mastodon/mastodon-ios.git synced 2024-12-16 02:39:20 +01:00
mastodon-app-ufficiale-ipho.../MastodonSDK/Tests/MastodonSDKTests/API/MastodonSDK+API+Instance.swift
2021-02-05 15:58:48 +08:00

42 lines
1.1 KiB
Swift

//
// MastodonSDK+API+Instance.swift
//
//
// Created by MainasuK Cirno on 2021-2-5.
//
import os.log
import XCTest
import Combine
@testable import MastodonSDK
extension MastodonSDKTests {
func testInstance() throws {
try _testInstance(domain: domain)
}
func _testInstance(domain: String) throws {
let theExpectation = expectation(description: "Fetch Instance Infomation")
Mastodon.API.Instance.instance(session: session, domain: domain)
.receive(on: DispatchQueue.main)
.sink { completion in
switch completion {
case .failure(let error):
XCTFail(error.localizedDescription)
case .finished:
break
}
} receiveValue: { response in
XCTAssertNotEqual(response.value.uri, "")
print(response.value)
theExpectation.fulfill()
}
.store(in: &disposeBag)
wait(for: [theExpectation], timeout: 10.0)
}
}