Skip to content

[no important files changed] Fix REST API tests #414

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

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

Conversation

rzuckerm
Copy link
Contributor

@rzuckerm rzuckerm commented Jun 27, 2025

I ran the tests for the example code 100 times with this script, and it passed every time:

#!/bin/bash
numIter=${1:-100}
pass=1
for i in $(seq 1 $numIter)
do
    echo
    echo "*** Iteration $i ***"
    pwsh -Command Invoke-Pester | tee output.txt
    if ! (tail -n 1 output.txt | grep -sq "Failed: 0,")
    then
        echo "FAILED!"
        pass=0
        break
    fi
done

rm -f output.txt
if [ $pass -ne 0 ]
then
    echo "PASSED"
fi

I also forced some failures and the tests failed. Here are examples of error messages where I deliberately changed the expected values in the tests:

  • Expected exactly @('balance', 'name', 'owed_bye', 'owes'), because those are the expected keys for expected["users"][1], but got @('balance', 'name', 'owed_by', 'owes').
  • Expected exactly 3, because that is the expected number of expected["users"] values, but got 2.
  • Expected exactly 1, because that is the expected value for expected["users"][0]["balance"], but got 0.

Copy link

Hello. Thanks for opening a PR on Exercism 🙂

We ask that all changes to Exercism are discussed on our Community Forum before being opened on GitHub. To enforce this, we automatically close all PRs that are submitted. That doesn't mean your PR is rejected but that we want the initial discussion about it to happen on our forum where a wide range of key contributors across the Exercism ecosystem can weigh in.

You can use this link to copy this into a new topic on the forum. If we decide the PR is appropriate, we'll reopen it and continue with it, so please don't delete your local branch.

If you're interested in learning more about this auto-responder, please read this blog post.


Note: If this PR has been pre-approved, please link back to this PR on the forum thread and a maintainer or staff member will reopen it.

Copy link

Hello 👋 Thanks for your PR.

This repo does not currently have dedicated maintainers. Our cross-track maintainers team will attempt to review and merge your PR, but it will likely take longer for your PR to be reviewed.

If you enjoy contributing to Exercism and have a track-record of doing so successfully, you might like to become an Exercism maintainer for this track.

Please feel free to ask any questions, or chat to us about anything to do with this PR or the reviewing process on the Exercism forum.

(cc @exercism/cross-track-maintainers)

@github-actions github-actions bot closed this Jun 27, 2025
Copy link

This PR touches files which potentially affect the outcome of the tests of an exercise. This will cause all students' solutions to affected exercises to be re-tested.

If this PR does not affect the result of the test (or, for example, adds an edge case that is not worth rerunning all tests for), please add the following to the merge-commit message which will stops student's tests from re-running. Please copy-paste to avoid typos.

[no important files changed]

For more information, refer to the documentation. If you are unsure whether to add the message or not, please ping @exercism/maintainers-admin in a comment. Thank you!

@rzuckerm rzuckerm changed the title Fix REST API tests [no important files changed] Fix REST API tests Jun 27, 2025
@glaxxie glaxxie reopened this Jun 27, 2025
@rzuckerm
Copy link
Contributor Author

rzuckerm commented Jun 27, 2025

@glaxxie Please hold off on reviewing this. I would like to revisit the error reporting. I think I can do a better job now that I know what the -Because option displays.

@rzuckerm rzuckerm marked this pull request as draft June 27, 2025 12:11
@rzuckerm rzuckerm marked this pull request as ready for review June 27, 2025 22:42
@rzuckerm
Copy link
Contributor Author

@glaxxie It is ready for review

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