Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
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 testCreateAnAnpplication() async throws {
try await _testCreateAnAnpplication(domain: domain)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo? _testCreateAnAnpplication -> _testCreateAnApplication

}

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

func _testCreateAnAnpplication(domain: String) async throws {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same typo

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