cap-md089 / evmplus-v6

The source code for the Event Manager+ suite of tools for Civil Air Patrol units
GNU General Public License v2.0
7 stars 4 forks source link

Unit Tests #93

Open r-a303931 opened 3 years ago

r-a303931 commented 3 years ago

Describe the issue The codebase lacks unit tests. Effort should be taken to get the codebase to a point where it is easy to add tests to the following packages:

  1. client
  2. common-lib
  3. discord-bot
  4. server
  5. server-common
  6. util-cli

The following packages are exempt:

  1. apis: this package should have its functionality tested in auto-api-tests. It is more or less data/linking together of programs and doesn't need tests included within the package
  2. auto-api-tests: this package is a test package and should be used to test auto-client-api
  3. auto-client-api: this package has auto-api-tests created for the sole purpose of testing this package
  4. server-jest-config: this package should provide a database connection for server, server-common, discord-bot, and util-cli tests

Of the 6 packages listed first, there should also be a substantive amount of tests to verify that each system works. This issue will have different requirements for each package, as follows:

  1. client: Before tests can be done well, I am planning on refactoring the client to use something similar to the elm architecture. This will mean the majority of state will be managed through props/redux/actions. Once this is done, unit tests can be done in full with a higher level of maintainability.
  2. common-lib: Jest is already configured. Tests just need to be added.
  3. discord-bot: Mocking of the Discord API may be necessary for this package, then tests can be written. Jest configuration will also have to be done.
  4. server: server-jest-config will need to be finished to provide a stable testing environment. Once this is accomplished, it will be possible to write tests as jest is already configured.
  5. server-common: server-jest-config will need to be finished to provide a stable testing environment. Once this is accomplished, it will be possible to write tests as jest is already configured.
  6. util-cli: server-jest-config will need to be finished to provide a stable testing environment. Once this is accomplished, it will be possible to write tests as jest is already configured.

The three big steps are as follows:

  1. Finish creating server-jest-config
  2. Rewrite the state management on the client to be more test friendly
  3. Write the tests

Fortunately, 1 and 2 can be done concurrently. Number 2 is already being done through the client-state-rework branch.