Skip to content

Instantly share code, notes, and snippets.

@thanakijwanavit
Created June 24, 2021 04:35
Show Gist options
  • Save thanakijwanavit/22f2b233d58bbbf2c27f8bb8c9e1ea0b to your computer and use it in GitHub Desktop.
Save thanakijwanavit/22f2b233d58bbbf2c27f8bb8c9e1ea0b to your computer and use it in GitHub Desktop.
testAsyncSwift
import XCTest
@testable import planyoBooking
import Alamofire
class TestResourcesApi: XCTestCase {
func testApiCall(){
let exp = expectation(description: #function)
asyncDetached(priority: .none) {
let result:TestApi = await PlanyoApi.callApiGetAsync(method: "api_test", params: [:], resultClass: TestApi.self)!
XCTAssertEqual(result.data, "API Test Response")
exp.fulfill()
}
wait(for: [exp], timeout: 5)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment