2021-02-05 05:10:34 +01:00
|
|
|
//
|
|
|
|
// 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
|
2021-02-05 08:58:48 +01:00
|
|
|
XCTAssertNotEqual(response.value.uri, "")
|
2021-02-05 05:10:34 +01:00
|
|
|
print(response.value)
|
|
|
|
theExpectation.fulfill()
|
|
|
|
}
|
|
|
|
.store(in: &disposeBag)
|
|
|
|
|
|
|
|
wait(for: [theExpectation], timeout: 10.0)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|