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

test: fix API integration getAll list elements #3249

Merged
merged 1 commit into from
Sep 29, 2023
Merged

Conversation

lawmicha
Copy link
Contributor

@lawmicha lawmicha commented Sep 28, 2023

Issue #

Description

The test was incorrectly aggregating the results from the list instance. The test will fail if the results came back on the first fetch call as it was getting dropped

AWSAPIPluginFunctionalTests.GraphQLConnectionScenario6Tests
  testGetBlogThenFetchPostsThenFetchComments, XCTAssertEqual failed: ("0") is not equal to ("2")
  /Users/runner/work/amplify-swift/amplify-swift/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario6Tests.swift:99
    let allPosts = try await getAll(list: resultPosts)
    XCTAssertEqual(allPosts.count, 2)
    guard let fetchedPost = allPosts.first(where: { (post) -> Bool in

testGetBlogThenFetchPostsThenFetchComments, failed - Could not set up - failed to get a post and its comments
/Users/runner/work/amplify-swift/amplify-swift/AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginFunctionalTests/GraphQLConnectionScenario6Tests.swift:103
    }), let comments = fetchedPost.comments else {
        XCTFail("Could not set up - failed to get a post and its comments")
        return


   Executed 67 tests, with 2 failures (0 unexpected) in 91.169 (91.202) seconds

General Checklist

  • Added new tests to cover change, if needed
  • Build succeeds with all target using Swift Package Manager
  • All unit tests pass
  • All integration tests pass
  • Security oriented best practices and standards are followed (e.g. using input sanitization, principle of least privilege, etc)
  • Documentation update for the change if required
  • PR title conforms to conventional commit style
  • New or updated tests include Given When Then inline code documentation and are named accordingly testThing_condition_expectation()
  • If breaking change, documentation/changelog update with migration instructions

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@lawmicha lawmicha requested a review from a team as a code owner September 28, 2023 18:26
@lawmicha lawmicha merged commit fc9fe26 into main Sep 29, 2023
77 checks passed
@lawmicha lawmicha deleted the test.api-functional branch September 29, 2023 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants