Skip to content

Commit 3d3c038

Browse files
authored
fix(api): support query predicate Temporal.DateTime, fix integ tests (#508)
* fix(api): support query predicate Temporal.DateTime, fix integ tests * fix schema, Comment's Post is required * replace with .now() * removed non-Model based BlogPostComment tests * fix indentation
1 parent c402cc1 commit 3d3c038

File tree

10 files changed

+65
-554
lines changed

10 files changed

+65
-554
lines changed

AmplifyPlugins/API/APICategoryPlugin.xcodeproj/project.pbxproj

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
21409C4F2384BA7E000A53C9 /* APIOperationResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21409C4E2384BA7E000A53C9 /* APIOperationResponse.swift */; };
1919
21409C602384DF17000A53C9 /* RESTOperationRequest+RESTRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21409C5F2384DF17000A53C9 /* RESTOperationRequest+RESTRequest.swift */; };
2020
21409C7223850BEE000A53C9 /* Todo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21409C7123850BEE000A53C9 /* Todo.swift */; };
21-
21409C7623850D1D000A53C9 /* BlogPostComment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21409C7523850D1D000A53C9 /* BlogPostComment.swift */; };
2221
214BD3B223FB5C4C0059A286 /* SubscriptionConnectionFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 214BD38B23FB5C4C0059A286 /* SubscriptionConnectionFactory.swift */; };
2322
214BD3D023FB76740059A286 /* AWSSubscriptionConnectionFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 214BD3CF23FB76740059A286 /* AWSSubscriptionConnectionFactory.swift */; };
2423
21598CE3239FF54E00529F29 /* RESTWithIAMIntegrationTests-amplifyconfiguration.json in Resources */ = {isa = PBXBuildFile; fileRef = 21598CDD239EDF1000529F29 /* RESTWithIAMIntegrationTests-amplifyconfiguration.json */; };
@@ -31,7 +30,6 @@
3130
217856742380C73600A30D19 /* AWSAPICategoryPlugin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B478F5FB2374DBF400C4F92B /* AWSAPICategoryPlugin.framework */; };
3231
217856832380C90600A30D19 /* RESTWithIAMIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 217856822380C90600A30D19 /* RESTWithIAMIntegrationTests.swift */; };
3332
217856852380C90600A30D19 /* AWSAPICategoryPlugin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B478F5FB2374DBF400C4F92B /* AWSAPICategoryPlugin.framework */; };
34-
2178569A2380D1E000A30D19 /* BlogPostCommentGraphQLWithAPIKeyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4DFA604237A61D00013E17B /* BlogPostCommentGraphQLWithAPIKeyTests.swift */; };
3533
217856A223810B9400A30D19 /* GraphQLWithUserPoolIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 217856A123810B9400A30D19 /* GraphQLWithUserPoolIntegrationTests.swift */; };
3634
217856A423810B9400A30D19 /* AWSAPICategoryPlugin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B478F5FB2374DBF400C4F92B /* AWSAPICategoryPlugin.framework */; };
3735
217856B72381F19400A30D19 /* AWSAPICategoryPluginEndpointType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 217856B62381F19300A30D19 /* AWSAPICategoryPluginEndpointType.swift */; };
@@ -275,7 +273,6 @@
275273
21409C6723850A9E000A53C9 /* AWSAPICategoryPluginTestCommon.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AWSAPICategoryPluginTestCommon.framework; sourceTree = BUILT_PRODUCTS_DIR; };
276274
21409C6A23850A9E000A53C9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
277275
21409C7123850BEE000A53C9 /* Todo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Todo.swift; sourceTree = "<group>"; };
278-
21409C7523850D1D000A53C9 /* BlogPostComment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlogPostComment.swift; sourceTree = "<group>"; };
279276
214BD38B23FB5C4C0059A286 /* SubscriptionConnectionFactory.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SubscriptionConnectionFactory.swift; sourceTree = "<group>"; };
280277
214BD3CF23FB76740059A286 /* AWSSubscriptionConnectionFactory.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AWSSubscriptionConnectionFactory.swift; sourceTree = "<group>"; };
281278
21598CDD239EDF1000529F29 /* RESTWithIAMIntegrationTests-amplifyconfiguration.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "RESTWithIAMIntegrationTests-amplifyconfiguration.json"; sourceTree = "<group>"; };
@@ -433,7 +430,6 @@
433430
B4DFA5DD237A611D0013E17B /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
434431
B4DFA5DE237A611D0013E17B /* AWSAPICategoryPlugin+ConfigureTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "AWSAPICategoryPlugin+ConfigureTests.swift"; sourceTree = "<group>"; };
435432
B4DFA5DF237A611D0013E17B /* AWSAPICategoryPlugin+URLSessionDelegateTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "AWSAPICategoryPlugin+URLSessionDelegateTests.swift"; sourceTree = "<group>"; };
436-
B4DFA604237A61D00013E17B /* BlogPostCommentGraphQLWithAPIKeyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlogPostCommentGraphQLWithAPIKeyTests.swift; sourceTree = "<group>"; };
437433
C2C05B10D5AD07D6A5C6463D /* Pods-AWSAPICategoryPlugin.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AWSAPICategoryPlugin.debug.xcconfig"; path = "Target Support Files/Pods-AWSAPICategoryPlugin/Pods-AWSAPICategoryPlugin.debug.xcconfig"; sourceTree = "<group>"; };
438434
C3D37DF0A0811D30BC333916 /* Pods-HostApp-GraphQLWithIAMIntegrationTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HostApp-GraphQLWithIAMIntegrationTests.release.xcconfig"; path = "Target Support Files/Pods-HostApp-GraphQLWithIAMIntegrationTests/Pods-HostApp-GraphQLWithIAMIntegrationTests.release.xcconfig"; sourceTree = "<group>"; };
439435
C55F4412E15F87E84BF3DD3F /* Pods_HostApp_AWSAPICategoryPluginTestCommon.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_HostApp_AWSAPICategoryPluginTestCommon.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -586,7 +582,6 @@
586582
21409C7F23850F3D000A53C9 /* Model */ = {
587583
isa = PBXGroup;
588584
children = (
589-
21409C7523850D1D000A53C9 /* BlogPostComment.swift */,
590585
21409C7123850BEE000A53C9 /* Todo.swift */,
591586
);
592587
path = Model;
@@ -622,14 +617,6 @@
622617
path = GraphQLModelBased;
623618
sourceTree = "<group>";
624619
};
625-
21598CED23A008F600529F29 /* BlogPostCommentGraphQLWithAPIKey */ = {
626-
isa = PBXGroup;
627-
children = (
628-
B4DFA604237A61D00013E17B /* BlogPostCommentGraphQLWithAPIKeyTests.swift */,
629-
);
630-
path = BlogPostCommentGraphQLWithAPIKey;
631-
sourceTree = "<group>";
632-
};
633620
217856232380BE5C00A30D19 /* AWSAPICategoryPluginIntegrationTests */ = {
634621
isa = PBXGroup;
635622
children = (
@@ -672,7 +659,6 @@
672659
children = (
673660
FA97F5522386CCF500EE9EFE /* AnyModelIntegrationTests.swift */,
674661
FA9554DF238B6C0B00D42A43 /* APICategoryPluginConcurrencyTests.swift */,
675-
21598CED23A008F600529F29 /* BlogPostCommentGraphQLWithAPIKey */,
676662
21598CEC23A008DB00529F29 /* GraphQLModelBased */,
677663
21598CEB23A0041400529F29 /* GraphQLSyncBased */,
678664
217856732380C73600A30D19 /* Info.plist */,
@@ -2082,7 +2068,6 @@
20822068
isa = PBXSourcesBuildPhase;
20832069
buildActionMask = 2147483647;
20842070
files = (
2085-
21409C7623850D1D000A53C9 /* BlogPostComment.swift in Sources */,
20862071
21409C7223850BEE000A53C9 /* Todo.swift in Sources */,
20872072
);
20882073
runOnlyForDeploymentPostprocessing = 0;
@@ -2100,7 +2085,6 @@
21002085
buildActionMask = 2147483647;
21012086
files = (
21022087
FAC5F9B1238B70EE00F70F02 /* APICategoryPluginConcurrencyTests.swift in Sources */,
2103-
2178569A2380D1E000A30D19 /* BlogPostCommentGraphQLWithAPIKeyTests.swift in Sources */,
21042088
216201E323920A6200AB2E10 /* GraphQLSyncBasedTests.swift in Sources */,
21052089
FA97F5532386CCF500EE9EFE /* AnyModelIntegrationTests.swift in Sources */,
21062090
217856C22383339D00A30D19 /* GraphQLModelBasedTests.swift in Sources */,

AmplifyPlugins/API/AWSAPICategoryPluginFunctionalTests/APICategoryPluginConcurrencyTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ class APICategoryPluginConcurrencyTests: XCTestCase {
1515
override func setUp() {
1616
Amplify.reset()
1717
Amplify.Logging.logLevel = .verbose
18-
ModelRegistry.register(modelType: AmplifyTestCommon.Post.self)
19-
ModelRegistry.register(modelType: AmplifyTestCommon.Comment.self)
18+
ModelRegistry.register(modelType: Post.self)
19+
ModelRegistry.register(modelType: Comment.self)
2020

2121
let apiConfig = APICategoryConfiguration(plugins: [
2222
"awsAPICategoryPlugin": [

AmplifyPlugins/API/AWSAPICategoryPluginFunctionalTests/AnyModelIntegrationTests.swift

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@ class AnyModelIntegrationTests: XCTestCase {
4242
}
4343

4444
func testCreateAsAnyModel() throws {
45-
45+
let createdAt: Temporal.DateTime = .now()
46+
let content = "Original post content as of \(createdAt)"
4647
let originalPost = Post(title: "Post title",
47-
content: "Original post content as of \(Date())",
48-
createdAt: Date())
48+
content: content,
49+
createdAt: createdAt)
4950
let anyPost = try originalPost.eraseToAnyModel()
5051

5152
let callbackInvoked = expectation(description: "Callback invoked")
@@ -93,9 +94,11 @@ class AnyModelIntegrationTests: XCTestCase {
9394
}
9495

9596
func testUpdateAsAnyModel() throws {
97+
let createdAt: Temporal.DateTime = .now()
98+
let content = "Original post content as of \(createdAt)"
9699
let originalPost = Post(title: "Post title",
97-
content: "Original post content as of \(Date())",
98-
createdAt: Date())
100+
content: content,
101+
createdAt: createdAt)
99102
let originalAnyPost = try originalPost.eraseToAnyModel()
100103

101104
let createCallbackInvoked = expectation(description: "Create callback invoked")
@@ -154,9 +157,11 @@ class AnyModelIntegrationTests: XCTestCase {
154157
}
155158

156159
func testDeleteAsAnyModel() throws {
160+
let createdAt: Temporal.DateTime = .now()
161+
let content = "Original post content as of \(createdAt)"
157162
let originalPost = Post(title: "Post title",
158-
content: "Original post content as of \(Date())",
159-
createdAt: Date())
163+
content: content,
164+
createdAt: createdAt)
160165
let originalAnyPost = try originalPost.eraseToAnyModel()
161166

162167
let createCallbackInvoked = expectation(description: "Create callback invoked")

0 commit comments

Comments
 (0)