ReflectionsProjections / rp-api-2023

Core Backend API Layer for Reflections | Projections 2023, powered by Nest.js
MIT License
0 stars 0 forks source link

Add Testing Framework with CI suite #23

Closed xuxey closed 1 year ago

xuxey commented 1 year ago

This PR adds a testing framework to write automated tests via Jest, per issue #14

Unit tests are defined in *.spec.ts files, and mocks can be injected within the beforeEach columns. Use attendees.service.spec.ts as a reference point to write future tests.

The CI suite runs the test suite for PRs and commits to main, as well as for branches starting with "test"

Side notes @rohannunu The sample tests are written on an outdated version of the schema. Please make sure to update these tests for the create function once this PR is merged in.

@aniketgargya since we're using the connection object directly for transactions, I've found a temporary workaround that injects a real connection to the dev mongo cluster.

github-actions[bot] commented 1 year ago

Coverage report

St.:grey_question:
Category Percentage Covered / Total
🟑 Statements
68.31% (+62.7% πŸ”Ό)
291/426
πŸ”΄ Branches
7.5% (+7.5% πŸ”Ό)
3/40
πŸ”΄ Functions
30.51% (+25.42% πŸ”Ό)
18/59
🟑 Lines
64.8% (+60.56% πŸ”Ό)
243/375

Test suite run success

12 tests passing in 10 suites.

Report generated by πŸ§ͺjest coverage report action from be30bfce07c0c55e591c3ab36a0a5b4218533a9b