Refactored Portal offer helper in /e2e/#26991
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
WalkthroughThis pull request modifies offer creation patterns across test infrastructure files. The offer factory module's imports are consolidated to import 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
e2e/data-factory/factories/offer-factory.ts (1)
1-4: Consolidate duplicate imports from@/data-factory.SonarCloud correctly flags that
@/data-factoryis imported multiple times. Merge into a single import statement for cleaner code.♻️ Proposed fix
-import {Factory} from '@/data-factory'; -import {faker} from '@faker-js/faker'; -import {generateId, generateSlug} from '@/data-factory'; -import type {HttpClient, PersistenceAdapter} from '@/data-factory'; +import {Factory, generateId, generateSlug} from '@/data-factory'; +import type {HttpClient, PersistenceAdapter} from '@/data-factory'; +import {faker} from '@faker-js/faker';🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@e2e/data-factory/factories/offer-factory.ts` around lines 1 - 4, Merge the duplicate imports from '@/data-factory' into a single import: combine Factory, generateId, generateSlug and the type imports HttpClient and PersistenceAdapter into one import declaration (keeping the separate import for faker unchanged); update the import line that currently references Factory and the separate line for generateId/generateSlug and the type import so all symbols come from a single '@/data-factory' import.e2e/tests/public/portal-offers.test.ts (1)
116-116: Consider removing unnecessary non-null assertions onstripe.SonarCloud flags these
stripe!assertions as unnecessary. Sincetest.use({stripeEnabled: true})guaranteesstripeis defined within this describe block, the non-null assertions are redundant. This is a minor cleanup.♻️ Example fix for one occurrence
- const offer = await createPortalSignupOffer(page.request, stripe!, { + const offer = await createPortalSignupOffer(page.request, stripe, {Also applies to: 139-139, 167-167, 197-197
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@e2e/tests/public/portal-offers.test.ts` at line 116, Remove the redundant non-null assertions on the `stripe` variable (the `!` after `stripe`) in the test calls — e.g., the call to `createPortalSignupOffer(page.request, stripe!, {...})` and the other occurrences flagged — because `test.use({stripeEnabled: true})` already guarantees `stripe` is defined; update each call site to pass `stripe` without `!` (search for `stripe!` in this test file and remove the `!` in calls like `createPortalSignupOffer` and the other create-portal offer helper invocations).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@e2e/data-factory/factories/offer-factory.ts`:
- Around line 1-4: Merge the duplicate imports from '@/data-factory' into a
single import: combine Factory, generateId, generateSlug and the type imports
HttpClient and PersistenceAdapter into one import declaration (keeping the
separate import for faker unchanged); update the import line that currently
references Factory and the separate line for generateId/generateSlug and the
type import so all symbols come from a single '@/data-factory' import.
In `@e2e/tests/public/portal-offers.test.ts`:
- Line 116: Remove the redundant non-null assertions on the `stripe` variable
(the `!` after `stripe`) in the test calls — e.g., the call to
`createPortalSignupOffer(page.request, stripe!, {...})` and the other
occurrences flagged — because `test.use({stripeEnabled: true})` already
guarantees `stripe` is defined; update each call site to pass `stripe` without
`!` (search for `stripe!` in this test file and remove the `!` in calls like
`createPortalSignupOffer` and the other create-portal offer helper invocations).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 4e5b6609-544b-4245-989f-e83c35ec250b
📒 Files selected for processing (8)
e2e/data-factory/factories/offer-factory.tse2e/data-factory/index.tse2e/data-factory/setup.tse2e/helpers/playwright/flows/offers.tse2e/helpers/services/offers/index.tse2e/helpers/services/offers/offers-service.tse2e/tests/public/portal-offers.test.tse2e/tests/public/stripe-offer-checkout.test.ts
💤 Files with no reviewable changes (2)
- e2e/helpers/services/offers/index.ts
- e2e/helpers/services/offers/offers-service.ts
ref #26991 Kept the rebased PR free of the Sonar duplicate-import warning without changing behavior.
ff8beb7 to
0ffa9f2
Compare
|


no ref