Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Mastodon.xcodeproj/xcshareddata/xcschemes/Mastodon.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
reference = "container:Mastodon/Mastodon.xctestplan"
default = "YES">
</TestPlanReference>
<TestPlanReference
reference = "container:MastodonSDK.xctestplan">
</TestPlanReference>
</TestPlans>
<Testables>
<TestableReference
Expand Down
2 changes: 1 addition & 1 deletion MastodonSDK.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"testTargets" : [
{
"skippedTests" : [
"MastodonSDKTests\/testCreateAnAnpplication()",
"MastodonSDKTests\/testCreateAnApplication()",
"MastodonSDKTests\/testHomeTimeline()",
"MastodonSDKTests\/testOAuthAuthorize()",
"MastodonSDKTests\/testRetrieveAccountInfo()",
Expand Down
4 changes: 3 additions & 1 deletion MastodonSDK/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ let package = Package(
name: "MastodonSDK",
dependencies: [
.product(name: "NIOHTTP1", package: "swift-nio"),
"MastodonCommon"
"MastodonCommon",
"CoreDataStack",
"MastodonLocalization"
]
),
.target(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,20 @@ import Combine

extension MastodonSDKTests {

func testCreateAnAnpplication() throws {
try _testCreateAnAnpplication(domain: domain)
func testCreateAnApplication() async throws {
try await _testCreateAnApplication(domain: domain)
}

func _testCreateAnAnpplication(domain: String) throws {
let theExpectation = expectation(description: "Create An Application")

func _testCreateAnApplication(domain: String) async throws {
let query = Mastodon.API.App.CreateQuery(
clientName: "XCTest",
redirectURIs: "mastodon://joinmastodon.org/oauth",
website: nil
)
Mastodon.API.App.create(session: session, domain: domain, query: query)
.receive(on: DispatchQueue.main)
.sink { completion in
switch completion {
case .failure(let error):
XCTFail(error.localizedDescription)
case .finished:
break
}
} receiveValue: { response in
XCTAssertEqual(response.value.name, "XCTest")
XCTAssertEqual(response.value.website, nil)
XCTAssertEqual(response.value.redirectURI, "urn:ietf:wg:oauth:2.0:oob")
theExpectation.fulfill()
}
.store(in: &disposeBag)

wait(for: [theExpectation], timeout: 5.0)
let response = try await Mastodon.API.App.create(session: session, domain: domain, query: query)
XCTAssertEqual(response.name, "XCTest")
XCTAssertEqual(response.website, nil)
XCTAssertEqual(response.redirectURI, "urn:ietf:wg:oauth:2.0:oob")
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ extension MastodonSDKTests {

func _testInstance(domain: String) throws {
let theExpectation = expectation(description: "Fetch Instance Infomation")
Mastodon.API.Instance.instance(session: session, domain: domain)

Mastodon.API.Instance.instance(session: session, authorization: .none, domain: domain)
.receive(on: DispatchQueue.main)
.sink { completion in
switch completion {
Expand Down Expand Up @@ -49,7 +49,7 @@ extension MastodonSDKTests {
func _testInstanceRules(domain: String) throws {
let theExpectation = expectation(description: "Fetch Instance Infomation")

Mastodon.API.Instance.instance(session: session, domain: domain)
Mastodon.API.Instance.instance(session: session, authorization: .none, domain: domain)
.receive(on: DispatchQueue.main)
.sink { completion in
switch completion {
Expand Down
Loading