Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(api): support query predicate Temporal.DateTime, fix integ tests #508

Merged
merged 5 commits into from
Jun 4, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
16 changes: 0 additions & 16 deletions AmplifyPlugins/API/APICategoryPlugin.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
21409C4F2384BA7E000A53C9 /* APIOperationResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21409C4E2384BA7E000A53C9 /* APIOperationResponse.swift */; };
21409C602384DF17000A53C9 /* RESTOperationRequest+RESTRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21409C5F2384DF17000A53C9 /* RESTOperationRequest+RESTRequest.swift */; };
21409C7223850BEE000A53C9 /* Todo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21409C7123850BEE000A53C9 /* Todo.swift */; };
21409C7623850D1D000A53C9 /* BlogPostComment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21409C7523850D1D000A53C9 /* BlogPostComment.swift */; };
214BD3B223FB5C4C0059A286 /* SubscriptionConnectionFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 214BD38B23FB5C4C0059A286 /* SubscriptionConnectionFactory.swift */; };
214BD3D023FB76740059A286 /* AWSSubscriptionConnectionFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 214BD3CF23FB76740059A286 /* AWSSubscriptionConnectionFactory.swift */; };
21598CE3239FF54E00529F29 /* RESTWithIAMIntegrationTests-amplifyconfiguration.json in Resources */ = {isa = PBXBuildFile; fileRef = 21598CDD239EDF1000529F29 /* RESTWithIAMIntegrationTests-amplifyconfiguration.json */; };
Expand All @@ -31,7 +30,6 @@
217856742380C73600A30D19 /* AWSAPICategoryPlugin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B478F5FB2374DBF400C4F92B /* AWSAPICategoryPlugin.framework */; };
217856832380C90600A30D19 /* RESTWithIAMIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 217856822380C90600A30D19 /* RESTWithIAMIntegrationTests.swift */; };
217856852380C90600A30D19 /* AWSAPICategoryPlugin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B478F5FB2374DBF400C4F92B /* AWSAPICategoryPlugin.framework */; };
2178569A2380D1E000A30D19 /* BlogPostCommentGraphQLWithAPIKeyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B4DFA604237A61D00013E17B /* BlogPostCommentGraphQLWithAPIKeyTests.swift */; };
217856A223810B9400A30D19 /* GraphQLWithUserPoolIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 217856A123810B9400A30D19 /* GraphQLWithUserPoolIntegrationTests.swift */; };
217856A423810B9400A30D19 /* AWSAPICategoryPlugin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B478F5FB2374DBF400C4F92B /* AWSAPICategoryPlugin.framework */; };
217856B72381F19400A30D19 /* AWSAPICategoryPluginEndpointType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 217856B62381F19300A30D19 /* AWSAPICategoryPluginEndpointType.swift */; };
Expand Down Expand Up @@ -275,7 +273,6 @@
21409C6723850A9E000A53C9 /* AWSAPICategoryPluginTestCommon.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AWSAPICategoryPluginTestCommon.framework; sourceTree = BUILT_PRODUCTS_DIR; };
21409C6A23850A9E000A53C9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
21409C7123850BEE000A53C9 /* Todo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Todo.swift; sourceTree = "<group>"; };
21409C7523850D1D000A53C9 /* BlogPostComment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlogPostComment.swift; sourceTree = "<group>"; };
214BD38B23FB5C4C0059A286 /* SubscriptionConnectionFactory.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SubscriptionConnectionFactory.swift; sourceTree = "<group>"; };
214BD3CF23FB76740059A286 /* AWSSubscriptionConnectionFactory.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AWSSubscriptionConnectionFactory.swift; sourceTree = "<group>"; };
21598CDD239EDF1000529F29 /* RESTWithIAMIntegrationTests-amplifyconfiguration.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "RESTWithIAMIntegrationTests-amplifyconfiguration.json"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -433,7 +430,6 @@
B4DFA5DD237A611D0013E17B /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
B4DFA5DE237A611D0013E17B /* AWSAPICategoryPlugin+ConfigureTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "AWSAPICategoryPlugin+ConfigureTests.swift"; sourceTree = "<group>"; };
B4DFA5DF237A611D0013E17B /* AWSAPICategoryPlugin+URLSessionDelegateTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "AWSAPICategoryPlugin+URLSessionDelegateTests.swift"; sourceTree = "<group>"; };
B4DFA604237A61D00013E17B /* BlogPostCommentGraphQLWithAPIKeyTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlogPostCommentGraphQLWithAPIKeyTests.swift; sourceTree = "<group>"; };
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>"; };
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>"; };
C55F4412E15F87E84BF3DD3F /* Pods_HostApp_AWSAPICategoryPluginTestCommon.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_HostApp_AWSAPICategoryPluginTestCommon.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -586,7 +582,6 @@
21409C7F23850F3D000A53C9 /* Model */ = {
isa = PBXGroup;
children = (
21409C7523850D1D000A53C9 /* BlogPostComment.swift */,
21409C7123850BEE000A53C9 /* Todo.swift */,
);
path = Model;
Expand Down Expand Up @@ -622,14 +617,6 @@
path = GraphQLModelBased;
sourceTree = "<group>";
};
21598CED23A008F600529F29 /* BlogPostCommentGraphQLWithAPIKey */ = {
isa = PBXGroup;
children = (
B4DFA604237A61D00013E17B /* BlogPostCommentGraphQLWithAPIKeyTests.swift */,
);
path = BlogPostCommentGraphQLWithAPIKey;
sourceTree = "<group>";
};
217856232380BE5C00A30D19 /* AWSAPICategoryPluginIntegrationTests */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -672,7 +659,6 @@
children = (
FA97F5522386CCF500EE9EFE /* AnyModelIntegrationTests.swift */,
FA9554DF238B6C0B00D42A43 /* APICategoryPluginConcurrencyTests.swift */,
21598CED23A008F600529F29 /* BlogPostCommentGraphQLWithAPIKey */,
21598CEC23A008DB00529F29 /* GraphQLModelBased */,
21598CEB23A0041400529F29 /* GraphQLSyncBased */,
217856732380C73600A30D19 /* Info.plist */,
Expand Down Expand Up @@ -2082,7 +2068,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
21409C7623850D1D000A53C9 /* BlogPostComment.swift in Sources */,
21409C7223850BEE000A53C9 /* Todo.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -2100,7 +2085,6 @@
buildActionMask = 2147483647;
files = (
FAC5F9B1238B70EE00F70F02 /* APICategoryPluginConcurrencyTests.swift in Sources */,
2178569A2380D1E000A30D19 /* BlogPostCommentGraphQLWithAPIKeyTests.swift in Sources */,
216201E323920A6200AB2E10 /* GraphQLSyncBasedTests.swift in Sources */,
FA97F5532386CCF500EE9EFE /* AnyModelIntegrationTests.swift in Sources */,
217856C22383339D00A30D19 /* GraphQLModelBasedTests.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class APICategoryPluginConcurrencyTests: XCTestCase {
override func setUp() {
Amplify.reset()
Amplify.Logging.logLevel = .verbose
ModelRegistry.register(modelType: AmplifyTestCommon.Post.self)
ModelRegistry.register(modelType: AmplifyTestCommon.Comment.self)
ModelRegistry.register(modelType: Post.self)
ModelRegistry.register(modelType: Comment.self)

let apiConfig = APICategoryConfiguration(plugins: [
"awsAPICategoryPlugin": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ class AnyModelIntegrationTests: XCTestCase {
}

func testCreateAsAnyModel() throws {

let createdAt: Temporal.DateTime = .now()
let content = "Original post content as of \(createdAt)"
let originalPost = Post(title: "Post title",
content: "Original post content as of \(Date())",
createdAt: Date())
content: content,
createdAt: createdAt)
let anyPost = try originalPost.eraseToAnyModel()

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

func testUpdateAsAnyModel() throws {
let createdAt: Temporal.DateTime = .now()
let content = "Original post content as of \(createdAt)"
let originalPost = Post(title: "Post title",
content: "Original post content as of \(Date())",
createdAt: Date())
content: content,
createdAt: createdAt)
let originalAnyPost = try originalPost.eraseToAnyModel()

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

func testDeleteAsAnyModel() throws {
let createdAt: Temporal.DateTime = .now()
let content = "Original post content as of \(createdAt)"
let originalPost = Post(title: "Post title",
content: "Original post content as of \(Date())",
createdAt: Date())
content: content,
createdAt: createdAt)
let originalAnyPost = try originalPost.eraseToAnyModel()

let createCallbackInvoked = expectation(description: "Create callback invoked")
Expand Down
Loading