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

Test Updates + API Refactors #178

Open
demariadaniel opened this issue Jan 28, 2025 · 1 comment
Open

Test Updates + API Refactors #178

demariadaniel opened this issue Jan 28, 2025 · 1 comment

Comments

@demariadaniel
Copy link
Contributor

demariadaniel commented Jan 28, 2025

Several updates which rose out of work related to: https://github.com/orgs/Pan-Canadian-Genome-Library/projects/1/views/1?pane=issue&itemId=85081519&issue=Pan-Canadian-Genome-Library%7Cdaco%7C3
and will facilitate future development on the API

Potentially worth breaking into multiple tickets

1. Refactor sequential tests
Separate sequential state manager tests so that each test runs independently (does not depend on outcome of previous test to pass)
Sequential test can create extra work by linking multiple functions together

See: #153

2. Mock Database Calls / Separate Unit Tests from Integration Tests
Known issue with Test Containers / Docker / Jenkins prevents running our current test suite in our pipelines for code change validation
Duplicate existing test files and convert to mocked unit tests where applicable

Relates to: https://github.com/orgs/Pan-Canadian-Genome-Library/projects/1/views/1?pane=issue&itemId=94825563&issue=Pan-Canadian-Genome-Library%7Cdaco%7C170

3. Refactor Service layer dependency injection
Create central dependency injection following example here: https://github.com/overture-stack/lyric/blob/main/packages/data-provider/src/core/provider.ts

function wrapper with dependencies, init services once, return object with functions
Replace current usage of getDbInstance and service(db)

4. Review shared DB transactions in stateManager

StateManager creates Action Records and also updates Application State values in the DB. This is done using a single database transaction, preventing issues that arise if one action succeeds but the other fails.
Confirm if the current approach (using transactions in StateManager to call separate service methods) works fine, or if this should be refactored so that a transaction is passed as an argument to the services.

5. Synchronize Zod / Schema / Shared Types

Due to issues with Drizzle pgEnum there is a disconnect between Schema definitions and the shared Types package that is leading to duplicate type definitions. See discussion:
https://github.com/Pan-Canadian-Genome-Library/daco/pull/174/files#r1932806224
With Zod added we should be able to resolve this and create shared definitions that are usable for both the front end and back end (when keys etc are all the same, still a need for some camelCase DTO definitions vs snake_case DB Model definitions )

@surajgoraya
Copy link
Member

Somewhat related, but as a stop-gap measure while we wait for automated integration testing, we should update the PR template to require a screenshot of the test suite passing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants