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(unit): unit tests for switch command #60

Merged
merged 5 commits into from
May 24, 2024
Merged

test(unit): unit tests for switch command #60

merged 5 commits into from
May 24, 2024

Conversation

guergabo
Copy link
Contributor

@guergabo guergabo commented May 23, 2024

Changes

Initial example of how dispatch could run the commands while redirecting stdout / stderr to make assertions. Might be useful for this issue #58.

Potential Next Steps

The global variables make running a bunch of unit tests in parallel more challenging, but if each CLI command takes in an "IO" interface with methods to read/write or make network calls then mocking, running tests in parallel, and focusing on the logic rather than environment setup would be a lot easier.

Copy link
Contributor

@achille-roussel achille-roussel left a comment

Choose a reason for hiding this comment

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

Thanks a lot for submitting your first contribution! I left a few comments, let me know what you think about it!.

cli/main.go Outdated Show resolved Hide resolved
cli/switch_test.go Outdated Show resolved Hide resolved
cli/switch_test.go Outdated Show resolved Hide resolved
@guergabo
Copy link
Contributor Author

guergabo commented May 24, 2024

Ready for review plus have follow-up issue to do similar for the other commands here: #61

Let me know if there is anything else I should change. Thanks.

Copy link
Contributor

@achille-roussel achille-roussel left a comment

Choose a reason for hiding this comment

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

The change is looking good, thanks for your contribution 🙌

@achille-roussel achille-roussel merged commit ea4a980 into dispatchrun:main May 24, 2024
2 checks passed
@guergabo guergabo deleted the unit-tests branch May 24, 2024 19:49
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