Skip to content

test: setup supertest and initial server tests #263#308

Merged
leandrumartin merged 1 commit intooss-slu:mainfrom
johns70:setup_server_test-#263
Mar 5, 2026
Merged

test: setup supertest and initial server tests #263#308
leandrumartin merged 1 commit intooss-slu:mainfrom
johns70:setup_server_test-#263

Conversation

@johns70
Copy link
Contributor

@johns70 johns70 commented Mar 1, 2026

Pull Request Summary

@leandrumartin 🙏
Closes #xxx

A brief description/summary of your PR here. What does it add? Why is it necessary? How was the change made, and how was it tested?

This pull request sets up the initial unit testing infrastructure for the boneset-api server. It adds supertest as a development dependency and creates the first test file (server.test.js) to verify the root endpoint. This is necessary to lay the foundation for future endpoint testing.

Screenshots

This is the screenshot of the tests:
digitalBonesTest

If applicable, add screenshots showing the before and after of any UI changes made.

PR Checklist

  • [x ] Project builds and runs
  • [x ] Tests and linters pass
  • [ x] Any related documentation has been updated, including JSDoc comments or docstrings

Detailed Description

A more detailed description and any additional information.
I made the following changes:

Dependency: I added supertest to the devDependencies in package.json.

Test syntax: I was confused here and opted to use CommonJS (require) instead of ES Modules (import) to ensure compatibility with the existing server.js architecture and avoid refactoring the entire backend. But if you need to make that change, let me know and I'll do it.

Testing tests with npx: I noticed there wasn't a script to run tests, so I had to manually configure it using npx jest server.test.js. However, if you'd like, let me know and I'll add the script to run the tests.

I was considering making the type="module" changes and implementing the test script, but it's better to complete the specific task you assigned me first, and then you can allow me to make those changes.

And finally, a technical note: The message "Cannot log after tests are done". This is a known side effect of the asynchronous initializeSearchCache() function in server.js, which terminates after testing. Since the tests themselves passed (2/2) and I didn't want to modify the core server logic, I left it as is for this pull request.

@johns70 johns70 requested a review from leandrumartin as a code owner March 1, 2026 00:08
Copy link
Collaborator

@leandrumartin leandrumartin left a comment

Choose a reason for hiding this comment

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

Looks good. Thank you for your contribution!

@leandrumartin leandrumartin merged commit 54a2de0 into oss-slu:main Mar 5, 2026
1 check failed
@johns70 johns70 deleted the setup_server_test-#263 branch March 6, 2026 03:09
@johns70
Copy link
Contributor Author

johns70 commented Mar 6, 2026

Thank you for the opportunity to collaborate 🙏✌

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