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: adds acceptance tests on top of json-formatted output #97

Merged
merged 2 commits into from
Nov 1, 2024

Conversation

ubiratansoares
Copy link
Contributor

@ubiratansoares ubiratansoares commented Nov 1, 2024

Closes #55

I tried to cover all scenarios* that don't depend on the Github API token for now, but if you want I can add then by tweaking a bit the CI pipeline and using the GITHUB_TOKEN issued by GHA on these tests.

In addition, I did my best to make the tests read as simple as possible, moving some boilterplate into helper functions.

Let me know your thoughs!

let auditable = workflow_under_test("artipacked.yml");
let cli_args = ["--format", "json", &auditable];

let execution = zizmor().args(cli_args).unwrap();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Quick note : this unwrap() is not the same one from Result or Option.

args() returns a Command type, hence there is no way to propagate an error here

Copy link
Owner

Choose a reason for hiding this comment

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

Makes sense, thanks for explaining. Also TIL that #[test] functions can return result types!

Signed-off-by: William Woodruff <william@yossarian.net>
Copy link
Owner

@woodruffw woodruffw left a comment

Choose a reason for hiding this comment

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

Thanks @ubiratansoares!

@woodruffw woodruffw changed the title Adds acceptance tests on top of json-formatted output test: adds acceptance tests on top of json-formatted output Nov 1, 2024
@woodruffw woodruffw merged commit a75f253 into woodruffw:main Nov 1, 2024
4 checks passed
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.

Testing: add known-output tests
2 participants