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: build type and graphql statement generation #757

Merged
merged 43 commits into from
Nov 27, 2023
Merged

Conversation

dpilch
Copy link
Member

@dpilch dpilch commented Nov 17, 2023

Description of changes

Test building an app after generating graphql statements and types.

Issue #, if available

N/A

Description of how you validated changes

Run the tests: https://us-east-1.console.aws.amazon.com/codesuite/codebuild/594813022831/projects/amplify-codegen-e2e-workflow/batch/amplify-codegen-e2e-workflow:0a304923-d204-44dd-9a2c-42e65de590d2?region=us-east-1

Checklist

  • PR description included

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

@dpilch dpilch marked this pull request as ready for review November 22, 2023 20:54
@dpilch dpilch requested a review from a team as a code owner November 22, 2023 20:54
await apiGqlCompile(projectRoot);
await generateModels(projectRoot);
await generateStatementsAndTypes(projectRoot);
writeFileSync(path.join(projectRoot, statementsDir, 'mutations.graphql'), 'foo\nbar'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: comma at the end to ;

await generateStatementsAndTypes(projectRoot);
writeFileSync(path.join(projectRoot, statementsDir, 'mutations.graphql'), 'foo\nbar'),
expect(() => parse(readFileSync(path.join(projectRoot, statementsDir, 'mutations.graphql'), 'utf8'))).toThrowError();
await androidBuild(projectRoot, { ...config });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this build is expected to fail right? Since we're adding invalid GQL.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The android compilation won't fail in this case because the GraphQL statements are generated with raw GraphQL syntax. Line 108 covers the failure. Line 109 isn't really needed in this case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's not needed, is there a reason we don't just remove it?

@dpilch dpilch requested a review from a team as a code owner November 22, 2023 23:30
Copy link
Member

@palpatim palpatim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment, otherwise LGTM

@dpilch dpilch merged commit 3c363c6 into main Nov 27, 2023
5 checks passed
@dpilch dpilch deleted the build-test-app branch November 27, 2023 17:16
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.

4 participants