Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
CI Pipeline Fixes: Backend Tests
Hey @pradeeban @karthiksathishjeemain So our GitHub Actions checks were failing for both the JS and Python backends, and I dug deep into it. The issue was that our tests were trying to hit a running server (like
localhost:3000), but in GitHub Actions, there is no server running in the background.I’ve refactored the tests to run "in-process" so they don't need a separate server. Here’s exactly what I did:
JavaScript Backend Changes
Refactored server.js: I changed it slightly to export the
appinstance. This lets us import the app in our tests. I also added a checkif (require.main === module)so it only starts listening on a port when we runnode server.js, but not when we import it for testing.Updated api.test.js:
http://localhost:3001to usingsupertest.supertesttakes our Expressappand simulates requests directly, which is the standard way to test Express apps in CI.Fixed package.json: The CI workflow was trying to run
npm run lint, but we didn't have a lint script, so I removed that step from the workflow to verify the tests first.Python Backend Changes
httpxDependency: Needed for the new testing tool.requeststofastapi.testclient.TestClient.supertestbut for Python/FastAPI—it tests the app instance directly without needinguvicornrunning in the background.Connection Refusederrors in CI.