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

feat(type-safe-api): generate handler tests #640

Merged
merged 3 commits into from
Nov 8, 2023
Merged

Conversation

cogwirrel
Copy link
Member

@cogwirrel cogwirrel commented Nov 6, 2023

  • Generate example junit tests for java handlers.
  • Generate example pytest tests for python handlers.
  • Generate example jest tests for typescript handlers.

Test generation is tied to handler generation, ie if the handler already exists the test won't be generated - it is only generated when a handler is newly generated. This provides a smoother upgrade path as tests won't be generated for existing operations in existing projects, and allows users to delete generated tests without worrying about them reappearing on the next build.

Additional Changes

Java:

  • Adds a lombok @Builder to the generated java input classes to make them easier to construct for tests.
  • Change the use of the logging interceptor in the generated java handler stubs to create a logger for the class, which is a more standard practice, and also simplifies the test as we don't need to put a logger in the interceptor context.

Fixes #570

Generate example junit tests for java handlers. Test generation is tied to handler generation, ie if
the handler already exists the test won't be generated - it is only generated when a handler is
newly generated. This provides a smoother upgrade path as tests won't be generated for existing
projects, and allows users to delete generated tests without worrying about them reappearing on the
next build.

re #570
@cogwirrel cogwirrel force-pushed the feat/java-tests branch 2 times, most recently from 888fc17 to 1493b04 Compare November 7, 2023 04:31
Generate example pytest tests for python handlers

re #570
@cogwirrel cogwirrel changed the title feat(type-safe-api): generate handler tests for java feat(type-safe-api): generate handler tests Nov 7, 2023
Generate example jest tests for typescript handlers.

Fixes #570
Copy link
Contributor

@agdimech agdimech left a comment

Choose a reason for hiding this comment

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

Great stuff mate!

@cogwirrel cogwirrel merged commit 09335a2 into mainline Nov 8, 2023
3 checks passed
@cogwirrel cogwirrel deleted the feat/java-tests branch November 8, 2023 01:09
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.

[FEATURE] (type-safe-api) Generate tests for handler packages
2 participants