Skip to content

Commit

Permalink
replace with .now()
Browse files Browse the repository at this point in the history
  • Loading branch information
lawmicha committed Jun 4, 2020
1 parent f4d8339 commit 1d22a27
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class AnyModelIntegrationTests: XCTestCase {
func testCreateAsAnyModel() throws {
let originalPost = AmplifyTestCommon.Post(title: "Post title",
content: "Original post content as of \(Date())",
createdAt: Temporal.DateTime(Date()))
createdAt: .now())
let anyPost = try originalPost.eraseToAnyModel()

let callbackInvoked = expectation(description: "Callback invoked")
Expand Down Expand Up @@ -94,7 +94,7 @@ class AnyModelIntegrationTests: XCTestCase {
func testUpdateAsAnyModel() throws {
let originalPost = AmplifyTestCommon.Post(title: "Post title",
content: "Original post content as of \(Date())",
createdAt: Temporal.DateTime(Date()))
createdAt: .now())
let originalAnyPost = try originalPost.eraseToAnyModel()

let createCallbackInvoked = expectation(description: "Create callback invoked")
Expand Down Expand Up @@ -155,7 +155,7 @@ class AnyModelIntegrationTests: XCTestCase {
func testDeleteAsAnyModel() throws {
let originalPost = AmplifyTestCommon.Post(title: "Post title",
content: "Original post content as of \(Date())",
createdAt: Temporal.DateTime(Date()))
createdAt: .now())
let originalAnyPost = try originalPost.eraseToAnyModel()

let createCallbackInvoked = expectation(description: "Create callback invoked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class GraphQLModelBasedTests: XCTestCase {
let createdPost = AmplifyTestCommon.Post(id: uuid,
title: uniqueTitle,
content: "content",
createdAt: Temporal.DateTime.now(),
createdAt: .now(),
draft: true,
rating: 12.3)
guard createPost(post: createdPost) != nil else {
Expand Down Expand Up @@ -156,7 +156,7 @@ class GraphQLModelBasedTests: XCTestCase {
func testCreatPostWithModel() {
let completeInvoked = expectation(description: "request completed")

let post = AmplifyTestCommon.Post(title: "title", content: "content", createdAt: Temporal.DateTime.now())
let post = AmplifyTestCommon.Post(title: "title", content: "content", createdAt: .now())
_ = Amplify.API.mutate(request: .create(post)) { event in
switch event {
case .success(let data):
Expand Down Expand Up @@ -185,7 +185,7 @@ class GraphQLModelBasedTests: XCTestCase {

let completeInvoked = expectation(description: "request completed")
let comment = AmplifyTestCommon.Comment(content: "commentContent",
createdAt: Temporal.DateTime.now(),
createdAt: .now(),
post: createdPost)
_ = Amplify.API.mutate(request: .create(comment)) { event in
switch event {
Expand Down Expand Up @@ -499,12 +499,12 @@ class GraphQLModelBasedTests: XCTestCase {
// MARK: Helpers

func createPost(id: String, title: String) -> AmplifyTestCommon.Post? {
let post = Post(id: id, title: title, content: "content", createdAt: Temporal.DateTime.now())
let post = Post(id: id, title: title, content: "content", createdAt: .now())
return createPost(post: post)
}

func createComment(content: String, post: AmplifyTestCommon.Post) -> AmplifyTestCommon.Comment? {
let comment = Comment(content: content, createdAt: Temporal.DateTime.now(), post: post)
let comment = Comment(content: content, createdAt: .now(), post: post)
return createComment(comment: comment)
}

Expand Down Expand Up @@ -556,7 +556,7 @@ class GraphQLModelBasedTests: XCTestCase {
var result: AmplifyTestCommon.Post?
let completeInvoked = expectation(description: "request completed")

let post = Post(id: id, title: title, content: "content", createdAt: Temporal.DateTime.now())
let post = Post(id: id, title: title, content: "content", createdAt: .now())
_ = Amplify.API.mutate(request: .update(post)) { event in
switch event {
case .success(let data):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class GraphQLSyncBasedTests: XCTestCase {
let modifiedPost = AmplifyTestCommon.Post(id: createdPost.model["id"] as? String ?? "",
title: updatedTitle,
content: createdPost.model["content"] as? String ?? "",
createdAt: Temporal.DateTime.now())
createdAt: .now())

let completeInvoked = expectation(description: "request completed")
var responseFromOperation: GraphQLResponse<MutationSync<AnyModel>>?
Expand Down Expand Up @@ -238,7 +238,7 @@ class GraphQLSyncBasedTests: XCTestCase {
let modifiedPost = AmplifyTestCommon.Post(id: createdPost.model["id"] as? String ?? "",
title: updatedTitle,
content: createdPost.model["content"] as? String ?? "",
createdAt: Temporal.DateTime(Date()))
createdAt: .now())

let completeInvoked = expectation(description: "request completed")
var responseFromOperation: GraphQLResponse<MutationSync<AnyModel>>?
Expand Down Expand Up @@ -308,7 +308,7 @@ class GraphQLSyncBasedTests: XCTestCase {
let modifiedPost = AmplifyTestCommon.Post(id: createdPost.model["id"] as? String ?? "",
title: updatedTitle,
content: createdPost.model["content"] as? String ?? "",
createdAt: Temporal.DateTime.now())
createdAt: .now())
let firstUpdateSuccess = expectation(description: "first update mutation should be successful")

let request = GraphQLRequest<MutationSyncResult>.updateMutation(of: modifiedPost,
Expand Down Expand Up @@ -525,7 +525,7 @@ class GraphQLSyncBasedTests: XCTestCase {
func createPost(id: String, title: String) -> MutationSyncResult? {
let post = AmplifyTestCommon.Post(id: id, title: title,
content: "content",
createdAt: Temporal.DateTime.now())
createdAt: .now())
return createPost(post: post)
}

Expand Down

0 comments on commit 1d22a27

Please sign in to comment.