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(@clack/core,@clack/prompts): mock API #163

Open
wants to merge 43 commits into
base: main
Choose a base branch
from

Conversation

Mist3rBru
Copy link
Contributor

@Mist3rBru Mist3rBru commented Sep 8, 2023

Mock API

This PR introduces a set of changes aimed to enable code testing.

Changes Made

  • isTestMode: serves as an internal flag to distinguish between test and production modes.
  • exposeTestUtils: serves as an internal function used to expose states and methods from the core Prompt component, along with additional utility functions. This exposure allows for fine-grained control over the behavior of the Prompt during testing.
  • mockPrompt: is a testing utility that sets the Prompt component to run in test mode. It returns all utilities configured through the exposeTestUtils function. This is a pivotal tool for simulating user interactions and thoroughly testing our code.

Observations

Test Coverage Result

image

Relates to #35

@changeset-bot
Copy link

changeset-bot bot commented Sep 8, 2023

🦋 Changeset detected

Latest commit: c40a558

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@clack/prompts Patch
@clack/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Mist3rBru Mist3rBru marked this pull request as ready for review September 18, 2023 17:21
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