Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test suite to repo #11

Merged
merged 26 commits into from
Feb 21, 2023
Merged

Add test suite to repo #11

merged 26 commits into from
Feb 21, 2023

Conversation

julesnuggy
Copy link
Contributor

@julesnuggy julesnuggy commented Feb 8, 2023

Objective

Add tests so that we can check students' work using automated tests (via GH Actions).

What Has Changed?

  • Installed & configured Jest
  • Use the Prisma Client's dmff object to retrieve the locally generated models
  • For each model, and at each relevant Requirement stage, write tests to assert:
    • that the expected fields/columns exist
    • that each field has the correct attributes:
  type,
  isId,
  isRequired,
  isUnique,
  defaultValue,
  relationFromFields,
  relationToFields,
  isList,

How To Test

  • Run npm ci
  • Update the prisma.schema file to contain the correct models
  • To run the tests for a specific requirement, run npm run test:<number> where <number> is replaced by the relevant digit (e.g. to test Requirement 2, run npm run test:2).
  • To run all tests, run npm run test:all.

@julesnuggy julesnuggy changed the title [WIP] Add test suite to repo Add test suite to repo Feb 8, 2023
@vherus
Copy link
Contributor

vherus commented Feb 9, 2023

Very nice! Can we add a github action to this so it runs on PRs? Something like this: https://github.com/boolean-uk/js-fundamentals-functions-1/blob/main/.github/workflows/standard-criteria-tests.yml

@julesnuggy
Copy link
Contributor Author

@vherus -- I knew I forgot to do something, but couldn't remember what! 🙈 Good shout!

Copy link
Contributor

@dearshrewdwit dearshrewdwit left a comment

Choose a reason for hiding this comment

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

Great stuff.

Can you standardise the CI test scripts and actions?

Follow the format below:

  • all exercises should have at least the defiend standard criteria testable with a workflow and corresponding test suite.
  • If there are defined extension criteria, there should be a separate workflow with a corresponding test suite.

Example: https://github.com/boolean-uk/api-express-database/tree/main/.github/workflows

If you want to define extra test scripts - feel free to do so, beyond the above standardised ones.

@julesnuggy
Copy link
Contributor Author

@dearshrewdwit -- thanks for the review. I've addressed your comment (I believe). There are no extensions, just the standard, so I've updated the workflow filename & action name, and also updated the npm script name.

Copy link
Contributor

@dearshrewdwit dearshrewdwit left a comment

Choose a reason for hiding this comment

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

Nice. Let's get it merged

@julesnuggy julesnuggy merged commit 7984267 into main Feb 21, 2023
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.

3 participants