Skip to content

Commit 6ad66ee

Browse files
Add tests for request chain with APQs
1 parent 751977f commit 6ad66ee

4 files changed

Lines changed: 45 additions & 1 deletion

File tree

Apollo.xcodeproj/xcshareddata/xcschemes/Apollo.xcscheme

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@
9393
<Test
9494
Identifier = "SQLiteStarWarsServerCachingRoundtripTests">
9595
</Test>
96+
<Test
97+
Identifier = "SQLiteStarWarsServerRequestChainAPQsTests">
98+
</Test>
99+
<Test
100+
Identifier = "SQLiteStarWarsServerRequestChainTests">
101+
</Test>
96102
<Test
97103
Identifier = "SQLiteStarWarsServerTests">
98104
</Test>

Apollo.xcodeproj/xcshareddata/xcschemes/ApolloSQLite.xcscheme

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@
8484
<Test
8585
Identifier = "StarWarsServerCachingRoundtripTests">
8686
</Test>
87+
<Test
88+
Identifier = "StarWarsServerRequestChainAPQsTests">
89+
</Test>
90+
<Test
91+
Identifier = "StarWarsServerRequestChainTests">
92+
</Test>
8793
<Test
8894
Identifier = "StarWarsServerTests">
8995
</Test>

Tests/ApolloCacheDependentTests/SQLiteCacheTests.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,15 @@ class SQLiteWatchQueryTests: WatchQueryTests {
4949
SQLiteTestCacheProvider.self
5050
}
5151
}
52+
53+
class SQLiteStarWarsServerRequestChainTests: StarWarsServerRequestChainTests {
54+
override var cacheType: TestCacheProvider.Type {
55+
SQLiteTestCacheProvider.self
56+
}
57+
}
58+
59+
class SQLiteStarWarsServerRequestChainAPQsTests: StarWarsServerRequestChainAPQsTests {
60+
override var cacheType: TestCacheProvider.Type {
61+
SQLiteTestCacheProvider.self
62+
}
63+
}

Tests/ApolloCacheDependentTests/StarWarsServerTests.swift

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,20 @@ class RequestChainConfig: TestConfig {
2828
}
2929
}
3030

31+
class RequestChainAPQsConfig: TestConfig {
32+
33+
func transport(with store: ApolloStore) -> NetworkTransport {
34+
let provider = LegacyInterceptorProvider(store: store)
35+
return RequestChainNetworkTransport(interceptorProvider: provider,
36+
endpointURL: URL(string: "http://localhost:8080/graphql")!,
37+
autoPersistQueries: true)
38+
}
39+
40+
func network(store: ApolloStore) -> NetworkTransport {
41+
return transport(with: store)
42+
}
43+
}
44+
3145
class APQsConfig: TestConfig {
3246
let transport = HTTPNetworkTransport(url: URL(string: "http://localhost:8080/graphql")!,
3347
enableAutoPersistedQueries: true)
@@ -51,7 +65,6 @@ class APQsWithGetMethodConfig: TestConfig, HTTPNetworkTransportRetryDelegate{
5165
transport.delegate = self
5266
return transport
5367
}
54-
5568
}
5669

5770
class StarWarsServerRequestChainTests: StarWarsServerTests {
@@ -61,6 +74,13 @@ class StarWarsServerRequestChainTests: StarWarsServerTests {
6174
}
6275
}
6376

77+
class StarWarsServerRequestChainAPQsTests: StarWarsServerTests {
78+
override func setUp() {
79+
super.setUp()
80+
config = RequestChainAPQsConfig()
81+
}
82+
}
83+
6484
class StarWarsServerAPQsGetMethodTests: StarWarsServerTests {
6585
override func setUp() {
6686
super.setUp()

0 commit comments

Comments
 (0)