test: [Stacked] migrate findTeamMembersMatchingAttributeLogic to integration tests#27697
Conversation
|
Hey there and thank you for opening this pull request! 👋🏼 We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted. Details: |
|
Paragon Review Skipped Hi @hariombalhara! Your Polarity credit balance is insufficient to complete this review. Please visit https://home.polarity.cc to add more credits and continue using Paragon reviews. |
There was a problem hiding this comment.
We don't mock getAttributes or DB queries here. So, we can better test the behavior e2e from the perspective of findTeamMembersMatchingAttributeLogic
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/features/routing-forms/lib/findTeamMembersMatchingAttributeLogic.integration-test.ts">
<violation number="1" location="packages/features/routing-forms/lib/findTeamMembersMatchingAttributeLogic.integration-test.ts:176">
P2: The `userId` parameter is accepted but never actually used. When `member.userId` is truthy, the code sets `userId = member.userId` but then immediately overwrites it by creating a new test user. Both branches of the if/else perform identical operations, making the `userId` parameter dead code. If a test passes a specific `userId` to reuse an existing user, a new user will be silently created instead.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Devin AI is addressing Cubic AI's review feedbackNew feedback has been sent to the existing Devin session. ✅ Pushed commit |
…and not working again
9cda53c to
029ea9b
Compare
…ep integration test version of negation operators tests Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
What does this PR do?
Migrates
findTeamMembersMatchingAttributeLogictests from mock-based unit tests to integration tests that run against a real database via Prisma. This gives higher confidence that attribute matching logic works correctly end-to-end.This PR only changes the test file — no production code is modified.
Changes
findTeamMembersMatchingAttributeLogic.test.ts→.integration-test.tsvi.mock()forgetAttributesandreact-awesome-query-builder/widgetsreplaced with real Prisma fixture helpers (createTestOrganization,createTestTeam,createTestUser,createTestAttribute,createTestAttributeAssignment)beforeAll/afterAllfor org+team setup/teardown,afterEachfor per-test resource cleanupuserId: 1,teamId: 1replaced with real DB-generated IDs viatestFixturesandcreatedUsers"SINGLE_SELECT" as const→AttributeType.SINGLE_SELECTnullreturn instead of thrown error (aligns with actual runtime behavior forAttributeType.TEXTwith select operators)Updates since last revision
mainby keeping the integration-test version of the negation operator tests (discarding the duplicate mock-based version from main)apps/web/modules/event-types/components/AddMembersWithSwitch.tsx— this PR is now test-onlyMandatory Tasks (DO NOT REMOVE)
How should this be tested?
Run the integration tests (requires a running Postgres database):
VITEST_MODE=integration yarn test packages/features/routing-forms/lib/findTeamMembersMatchingAttributeLogic.integration-test.tsHuman Review Checklist
createAttributesScenario, theif (member.userId)branch creates a new user and ignores the provideduserId— this looks like dead code / a bug. Verify this is intentional or clean it up.Link to Devin run: https://app.devin.ai/sessions/c58b5f1e6387461bae9e6b77a6a163a8
Requested by: @joeauyeung