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(parser): refactor appsync schema tests #3388

Merged
merged 3 commits into from
Jan 14, 2025

Conversation

svozza
Copy link
Contributor

@svozza svozza commented Nov 29, 2024

Summary

As mentioned in #3305, rather than have lots of JSON events that we have to read from the filesystem, we should have one event that we extend/amend to suit each test case. This PR refactors the AppSync schema tests to do this.

Changes

  • Changed tests to read a single event from the file system
  • Added an omit function to packages/parser/tests/unit/schema/utils.ts that allow us to give a list of fields to be omitted from an object. This is useful for testing.invalid schemas so we can can test where properties that must be present are not.

Issue number:
n/a


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@svozza svozza requested review from a team as code owners November 29, 2024 21:02
@boring-cyborg boring-cyborg bot added the tests PRs that add or change tests label Nov 29, 2024
@pull-request-size pull-request-size bot added the size/XL PRs between 500-999 LOC, often PRs that grown with feedback label Nov 29, 2024
@svozza svozza force-pushed the refactor-appsync-schema-tests branch from 7d53e05 to 2d84ccd Compare November 29, 2024 21:18
@svozza svozza force-pushed the refactor-appsync-schema-tests branch from 2d84ccd to 821a5d4 Compare December 9, 2024 15:37
@dreamorosi
Copy link
Contributor

Hi @svozza, we'll try to review this by early next week - thank you for your patience!

@svozza svozza force-pushed the refactor-appsync-schema-tests branch from 821a5d4 to f3a6ad4 Compare December 13, 2024 16:18
@svozza
Copy link
Contributor Author

svozza commented Dec 13, 2024

No worries, I know Re:Invent has taken up most of the team's capacity.

@svozza svozza force-pushed the refactor-appsync-schema-tests branch from f3a6ad4 to 5d49edb Compare December 23, 2024 15:21
@svozza svozza force-pushed the refactor-appsync-schema-tests branch from 5d49edb to 0a4b414 Compare January 9, 2025 22:32
Copy link
Contributor

@dreamorosi dreamorosi left a comment

Choose a reason for hiding this comment

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

Thank you for your patience and for the PR.

I have left a couple request for changes but I am a big fan of the overall direction of the PR. Appreciate it!

packages/parser/tests/unit/schema/appsync.test.ts Outdated Show resolved Hide resolved
packages/parser/tests/unit/schema/appsync.test.ts Outdated Show resolved Hide resolved
packages/parser/tests/unit/schema/appsync.test.ts Outdated Show resolved Hide resolved
@svozza svozza force-pushed the refactor-appsync-schema-tests branch from 0a4b414 to 7925b3d Compare January 14, 2025 12:13
@dreamorosi dreamorosi linked an issue Jan 14, 2025 that may be closed by this pull request
2 tasks
@dreamorosi dreamorosi self-requested a review January 14, 2025 12:24
Copy link
Contributor

@dreamorosi dreamorosi left a comment

Choose a reason for hiding this comment

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

Thank you for the PR and for the patience!

@dreamorosi dreamorosi merged commit 0ef15a7 into aws-powertools:main Jan 14, 2025
38 checks passed
Copy link
Contributor

@aws-powertools/lambda-typescript No related issues found. Please ensure 'pending-release' label is applied before releasing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XL PRs between 500-999 LOC, often PRs that grown with feedback tests PRs that add or change tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Maintenance: Parser getTestEvent function can be simplified
2 participants