Skip to content

Commit d21cca0

Browse files
committed
Merge branch 'develop' into merge-develop-into-oms
2 parents f5fd3c3 + f99bc2a commit d21cca0

File tree

47 files changed

+6527
-992
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+6527
-992
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
description: QA Tests for Template Retail React App Test Generation Rules
3+
globs: ["packages/template-retail-react-app/app/components/**/*-underTest.test.{js,jsx}"]
4+
alwaysApply: false
5+
---
6+
# QA Tests for Template Retail React App Test Patterns
7+
8+
## Purpose
9+
This file contains test cases to verify that the `unit-tests-template-retail-react-app.mdc` rule effectively guides the creation of consistent and robust React component tests.
10+
11+
## Test Cases
12+
13+
### Test 1: DrawerMenu Component Test Generation
14+
**Workflow:** Generate → Analyze → Cleanup (NO test execution)
15+
16+
**Steps:**
17+
1. **Generate:** Create new test file `drawer-menu-underTest.test.js` (colocated with existing drawer-menu component at `packages/template-retail-react-app/app/components/drawer-menu/`)
18+
2. **Apply Rules:** Use `@/testing` (located at `.cursor/rules/testing/unit-tests-generic.mdc` and `.cursor/rules/testing/unit-tests-template-retail-react-app.mdc`)
19+
3. **Prompt:** "Write unit test for drawer-menu component"
20+
4. **Analyze:** Perform static code analysis against verification patterns (see below)
21+
5. **Cleanup:** Delete the generated test file after validation
22+
23+
**Important:** DO NOT run the test after creation - skip test execution entirely
24+
25+
**Verify that the newly generated test file follows these patterns:**
26+
1. Test Setup
27+
- Uses `renderWithProviders` from `@salesforce/retail-react-app/app/utils/test-utils`
28+
- Gets user events from return value: `const {user} = renderWithProviders(...)`
29+
- Includes `beforeEach(() => jest.clearAllMocks())`
30+
31+
2. Import Structure
32+
- Does NOT import `userEvent` directly
33+
- Uses existing mock data from `@salesforce/retail-react-app/app/mocks/`
34+
- Imports `screen` from `@testing-library/react`
35+
36+
3. Test Organization
37+
- Uses `describe` block with component name
38+
- Individual `test` or `it` blocks for different scenarios
39+
- Async/await patterns for user interactions
40+
41+
4. API Mocking
42+
- Uses `prependHandlersToServer` or `msw` for API mocking when needed
43+
44+
**Failure Indicators:**
45+
- Direct import of `userEvent` from `@testing-library/user-event`
46+
- Using custom render function instead of `renderWithProviders`
47+
- Creating new mock data instead of using existing mocks
48+
- Missing Commerce SDK context providers
49+
- Not using async/await for user interactions
50+
51+
**Expected Output:**
52+
Provide a clear, structured report based on **static code analysis only** (no test execution):
53+
- ✅ **PASS** or ❌ **FAIL** for each verification point
54+
- Specific line numbers and code snippets for any failures
55+
- Summary: `X/Y patterns followed correctly`
56+
- Overall result: **RULES EFFECTIVE** or **RULES NEED IMPROVEMENT**
57+
58+
**Cleanup:**
59+
- Delete the generated test file `drawer-menu-underTest.test.js` after QA validation is complete

.github/CODEOWNERS

Lines changed: 60 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,64 @@
11
# https://help.github.com/en/enterprise/2.17/user/articles/about-code-owners
22

3-
# These owners will be the default owners for everything in
4-
# the repo. Unless a later match takes precedence,
5-
# @global-owner1 and @global-owner2 will be requested for
6-
# review when someone opens a pull request.
3+
# Global directories
4+
.cursor/ @SalesforceCommerceCloud/mobifyers
5+
.github/ @SalesforceCommerceCloud/mobifyers
6+
e2e/ @SalesforceCommerceCloud/mobifyers
7+
scripts/ @SalesforceCommerceCloud/mobifyers
8+
9+
# Package-specific ownership
10+
packages/commerce-sdk-react/ @SalesforceCommerceCloud/mobifyers
11+
packages/internal-lib-build/ @SalesforceCommerceCloud/mobifyers
12+
packages/pwa-kit-create-app/ @SalesforceCommerceCloud/mobifyers
13+
packages/pwa-kit-dev/ @SalesforceCommerceCloud/mobifyers
14+
packages/pwa-kit-mcp/ @SalesforceCommerceCloud/mobifyers
15+
packages/pwa-kit-react-sdk/ @SalesforceCommerceCloud/mobifyers
16+
packages/pwa-kit-runtime/ @SalesforceCommerceCloud/mobifyers
17+
packages/template-express-minimal/ @SalesforceCommerceCloud/mobifyers
18+
packages/template-mrt-reference-app/ @SalesforceCommerceCloud/mobifyers
19+
packages/template-retail-react-app/ @SalesforceCommerceCloud/mobifyers
20+
packages/template-typescript-minimal/ @SalesforceCommerceCloud/mobifyers
21+
packages/test-commerce-sdk-react/ @SalesforceCommerceCloud/mobifyers
22+
23+
# Root configuration and documentation files
24+
/README.md @SalesforceCommerceCloud/mobifyers
25+
/CODE_OF_CONDUCT.md @SalesforceCommerceCloud/mobifyers
26+
/CONTRIBUTING.md @SalesforceCommerceCloud/mobifyers
27+
/SECURITY.md @SalesforceCommerceCloud/mobifyers
28+
/STATEMENTS.md @SalesforceCommerceCloud/mobifyers
29+
/TERMS_OF_USE.md @SalesforceCommerceCloud/mobifyers
30+
/LICENSE @SalesforceCommerceCloud/mobifyers
31+
/.eslintrc.js @SalesforceCommerceCloud/mobifyers
32+
/.gitattributes @SalesforceCommerceCloud/mobifyers
33+
/.gitignore @SalesforceCommerceCloud/mobifyers
34+
/.prettierignore @SalesforceCommerceCloud/mobifyers
35+
/.prettierrc.yaml @SalesforceCommerceCloud/mobifyers
36+
/lerna.json @SalesforceCommerceCloud/mobifyers
37+
/package.json @SalesforceCommerceCloud/mobifyers
38+
/package-lock.json @SalesforceCommerceCloud/mobifyers
39+
/playwright.config.js @SalesforceCommerceCloud/mobifyers
40+
/.git2gus/ @SalesforceCommerceCloud/mobifyers
41+
42+
# Specific feature file ownership (overrides package-level rules above)
43+
44+
# BOPIS (Buy Online Pick up In Store) feature files - PR #2646
45+
packages/template-retail-react-app/app/components/store-display/ @SalesforceCommerceCloud/cc-spark
46+
packages/template-retail-react-app/app/hooks/use-selected-store.js @SalesforceCommerceCloud/cc-spark
47+
packages/template-retail-react-app/app/hooks/use-pickup-shipment.js @SalesforceCommerceCloud/cc-spark
48+
packages/template-retail-react-app/app/hooks/use-pickup-shipment.test.js @SalesforceCommerceCloud/cc-spark
49+
e2e/tests/desktop/bopis.spec.js @SalesforceCommerceCloud/cc-spark
50+
51+
# Bonus Products feature files - PR #2704
52+
packages/template-retail-react-app/app/components/product-item/bonus-product-quantity.jsx @SalesforceCommerceCloud/cc-sharks
53+
packages/template-retail-react-app/app/components/product-item/bonus-product-quantity.test.jsx @SalesforceCommerceCloud/cc-sharks
54+
packages/template-retail-react-app/app/components/product-item/product-quantity-picker.jsx @SalesforceCommerceCloud/cc-sharks
55+
packages/template-retail-react-app/app/components/product-item/product-quantity-picker.test.jsx @SalesforceCommerceCloud/cc-sharks
56+
packages/template-retail-react-app/app/pages/cart/partials/bonus-products-title.jsx @SalesforceCommerceCloud/cc-sharks
57+
packages/template-retail-react-app/app/pages/cart/partials/bonus-products-title.test.js @SalesforceCommerceCloud/cc-sharks
58+
59+
# Standard Products feature files - PR #2697
60+
packages/template-retail-react-app/app/mocks/standard-product.js @SalesforceCommerceCloud/cc-sharks
61+
packages/template-retail-react-app/app/utils/add-to-cart-utils.js @SalesforceCommerceCloud/cc-sharks
62+
763

8-
* @SalesforceCommerceCloud/mobifyers
964
#ECCN:Open Source
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Validate CODEOWNERS
2+
3+
# Only run when CODEOWNERS file changes - efficient!
4+
on:
5+
pull_request:
6+
paths:
7+
- '.github/CODEOWNERS'
8+
push:
9+
branches:
10+
- develop
11+
- 'release-*'
12+
paths:
13+
- '.github/CODEOWNERS'
14+
15+
jobs:
16+
validate:
17+
name: Validate CODEOWNERS File
18+
runs-on: ubuntu-latest
19+
# Only run on pushes or PRs from the same repository (not forks)
20+
# This prevents permission issues with GITHUB_TOKEN on external PRs
21+
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
22+
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
27+
- name: Validate CODEOWNERS structure
28+
uses: mszostok/codeowners-validator@v0.7.4
29+
with:
30+
# files: paths exist, duppatterns: no duplicates, syntax: valid format
31+
checks: "files,duppatterns,syntax"
32+
github_access_token: "${{ secrets.GITHUB_TOKEN }}"

0 commit comments

Comments
 (0)