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

Split Wizard up into testable components #122

Merged
merged 4 commits into from
Aug 18, 2021

Conversation

kylehodgetts
Copy link
Contributor

@kylehodgetts kylehodgetts commented Aug 18, 2021

As the Wizard is a core part of onboarding new users to Kusk and therefore it should be well written and tested to increase confidence when releasing it.

This PR splits the wizard up into smaller components that we can test in isolation / mock where the real thing isn't required

Changes

  • create internal wizard prompt package with a default implementation of a prompter interface. The idea behind this is that we can't use the promptui package in tests because a) it logs to stdout b) requires an interactive stdin session. This way we can mock a test prompter in the tests and have it return set values
  • Each generator now has a dedicated flow and the wizard itself simply fetches the flows and runs them without calling a specifically named function like flowAmbassador. This separates concerns as now the wizard doesn't need to care about what flow to run, it hands that off to another component.

Checklist

  • tested locally
  • added new dependencies
  • updated the docs
  • added a test

Kyle Hodgetts added 4 commits August 18, 2021 11:18
…it comes to writing tests as we can implement a test prompter that returns set values. The default implementation of the prompter requires an interactice stdin session
@kylehodgetts kylehodgetts changed the title WIP: Refactor wizard WIP: Split Wizard up into testable components Aug 18, 2021
Copy link
Contributor

@dobegor dobegor left a comment

Choose a reason for hiding this comment

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

LGTM!

@kylehodgetts kylehodgetts changed the title WIP: Split Wizard up into testable components Split Wizard up into testable components Aug 18, 2021
@kylehodgetts kylehodgetts merged commit 35f73eb into main Aug 18, 2021
@kylehodgetts kylehodgetts deleted the kylehodgetts/refactor/wizard branch August 18, 2021 12:48
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