boolean-uk / software-developer

0 stars 0 forks source link

Introduce API specs and CI to all API exercises from Address Book onwards #130

Closed vherus closed 1 year ago

vherus commented 1 year ago

This repo has a complete CI workflow: https://github.com/boolean-uk/database-cinema-booking-api/

Each API exercise from Address Book onwards needs a similar setup. This includes:

The repos should contain a complete suite of core criteria tests. Any starter code tests should be separated into their own test directory so the main branch CI can run only those, which should pass.

Core criteria CI should run all of the core criteria tests.

Extension CI should run all of the extension tests - one extension test should be provided in the repo as a guide for students, but they need to write the rest of them.

The exercise requirements should be put into API specs instead of listed in the README, a separate one for core criteria and extension criteria. These can be served from the repo docs/ folder on GitHub Pages with links to the deployed pages in the README of the exercise, see the cinema API exercise for an example.

To generate the docs, we need to create some Open API .yml files - these can also be seen in the root directory of the cinema API exercise. Once the yml files have been created, a separate one for core & extensions, run the below command to generate the appropriate documentation:

npx redoc-cli build name-of-core-criteria-yml-file.yml -o docs/index.html for the core criteria spec

npx redoc-cli build name-of-ext-criteria-yml-file.yml -o docs/extensions.html for the extension criteria spec

The tests themselves rely on jest and supertest, with some helper functions to wipe databases between test runs. Examine the cinema API exercise test suite to see how this is configured.

When everything is setup in a repo, it must be tested completely from a students point of view to verify before rolling it out. This means completing the exercise as a student would and keeping an eye out for flaws / improvements.

vherus commented 1 year ago

Depends on https://github.com/boolean-uk/software-developer/issues/129

vherus commented 1 year ago

More info here: https://github.com/boolean-uk/software-developer/issues/115

vherus commented 1 year ago

Exercises this CI needs to be added to:

dearshrewdwit commented 1 year ago

Current work in progress: https://github.com/boolean-uk/api-express-modular-routing/pull/3

dearshrewdwit commented 1 year ago

This exercise has now been updated: https://github.com/boolean-uk/api-express-modular-routing

dearshrewdwit commented 1 year ago

This exercise has now been updated: https://github.com/boolean-uk/api-express-counter

vherus commented 1 year ago

https://github.com/boolean-uk/api-express-address-book

Update README instructions to follow a specific set up