Document and write tests for any server function
BookBrainz is a project to gather information about all of the books (and other written works) in the world. To make this happen, we're creating an online database which anyone can add to at https://bookbrainz.org.
To make sure that the site runs well, it's important that we test our code. It's also important to have good documentation so that it's easy for other people to understand and make the code better. But both of these tasks take lots of time, so they often get ignored when we're adding new stuff to BookBrainz.
In this task, we'd like you to pick any server function in the code (under the src/server directory in GitHub repository] that has no documentation and no unit tests. Then, spend some time understanding what this function does, and where it gets used. Finally, write unit tests (in the tests directory of the repository) to check whether the function works with:
• the expected input? • invalid input of the correct type? • input of the wrong type? • null arguments? • inputs that activate its conditional branches?
Once tests are written, write flow type annotations and add documentation in JSDoc format.
To submit your work, clone your fork of the bookbrainz-site repository on GitHub and create a new branch starting with "server-function-" and ending in your GCI username. Commit your changes, using small commits and using the conventions here. Finally, push your work to GitHub, and create a new Pull Request.