-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraphQLAPIAdapterTests.swift
More file actions
41 lines (35 loc) · 1.16 KB
/
GraphQLAPIAdapterTests.swift
File metadata and controls
41 lines (35 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import Apollo
import ApolloAPI
@testable import GraphQLAPIKit
import XCTest
final class GraphQLAPIAdapterTests: XCTestCase {
// swiftlint:disable:next force_unwrapping
let testURL = URL(string: "https://api.example.com/graphql")!
// MARK: - Initialization Tests
func testAdapterInitializationWithMinimalParameters() {
let adapter = GraphQLAPIAdapter(url: testURL)
XCTAssertNotNil(adapter)
}
func testAdapterInitializationWithCustomHeaders() {
let headers = [
"Authorization": "Bearer token123",
"Content-Type": "application/json",
"X-API-Key": "secret"
]
let adapter = GraphQLAPIAdapter(
url: testURL,
defaultHeaders: headers
)
XCTAssertNotNil(adapter)
}
func testAdapterInitializationWithCustomURLSessionConfiguration() {
let config = URLSessionConfiguration.default
config.timeoutIntervalForRequest = 30
config.timeoutIntervalForResource = 60
let adapter = GraphQLAPIAdapter(
url: testURL,
urlSessionConfiguration: config
)
XCTAssertNotNil(adapter)
}
}