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

fix: add integration tests for user domain #2322

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

iamacook
Copy link
Member

@iamacook iamacook commented Feb 4, 2025

Summary

We test the user (and wallet) domain via controller tests. This adds integration tests for the repositories of the aforementioned controller, covering database-relevant cases.

Changes

  • Make Wallet['user_id'] non-nullable
  • Add integration test for UserRepository
  • Add integration test ffor WalletRepository

@iamacook iamacook self-assigned this Feb 4, 2025
@@ -19,6 +19,7 @@ export class Wallet implements z.infer<typeof WalletSchema> {

@ManyToOne(() => User, (user: User) => user.id, {
onDelete: 'CASCADE',
nullable: false,
Copy link
Member Author

Choose a reason for hiding this comment

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

This otherwise defaults to true meaning that Wallets could be added without a User.

@iamacook iamacook marked this pull request as ready for review February 4, 2025 16:10
@iamacook iamacook requested a review from a team as a code owner February 4, 2025 16:10
src/domain/users/users.repository.integration.spec.ts Outdated Show resolved Hide resolved
src/domain/users/users.repository.integration.spec.ts Outdated Show resolved Hide resolved
src/domain/users/users.repository.integration.spec.ts Outdated Show resolved Hide resolved
src/domain/users/users.repository.integration.spec.ts Outdated Show resolved Hide resolved
src/domain/users/users.repository.integration.spec.ts Outdated Show resolved Hide resolved
src/domain/users/users.repository.integration.spec.ts Outdated Show resolved Hide resolved
src/domain/users/users.repository.integration.spec.ts Outdated Show resolved Hide resolved
src/domain/users/users.repository.integration.spec.ts Outdated Show resolved Hide resolved
@iamacook
Copy link
Member Author

iamacook commented Feb 6, 2025

@PooyaRaki, I'm having issues with the tests passing. I initially thought it was because I moved the getRepositorys outside the tests but have since tried assigning them after migration, then inside tests (which worked before) to no avail.

Copy link
Contributor

@PooyaRaki PooyaRaki left a comment

Choose a reason for hiding this comment

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

Since the test issue happened only to the PR and it seems to be a CI issue I'll approve the PR but the issue should be fixed before merging to main.

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.

2 participants