Skip to content

Development

Qanpi edited this page Jan 15, 2024 · 2 revisions

Development workflow

Exception handling

Back-end

Validation is relatively sophisticated on the back-end, reporting both an error code and error message on failure. These are later caught by express-js middleware and reported as errors to the client making the request.

Front-end

On the front-end, most exceptions arise from failed networks requests to the back-end via React-Query. For GET requests, Copa will simply attempt to retry a failed request while showing a loading screen in the process. For mutations (requests like POST, PATCH etc.), Copa will catch errors at the top-level and display an error message to the end user, based on the error code and message received from the server.

For instance, the error below is displayed if a particular team name has already been taken.

Alt text

Testing

Currently, there are no front-end tests targetted at the React side of the application. However, a large area of the back-end logic is covered by integration tests that must pass before each deployment.

These tests are written in Jest with help of Supertest for mimicking network requests. Below is an example of a test that validates the team can not register for a tournament past its registration deadline.

Git-flow

Copa follows (with the occasional exception) a git workflow outlined here. At its core, this involves having five different types of branches, as shown in the diagram below. Although, hotfixes and release branches are used more rarely.

Alt text

Deployment

Currently, Copa is deployed to Azure as an App Service. The deployments dispatch automatically on commits to the main branch.

Previously, there were several deployment slots for testing, production etc. However, now all deployments automatically flow into the production state of Copa (for budget savings), and so should first be appropriately validated.