codeant-ai-for-open-source[bot] commented on code in PR #37479:
URL: https://github.com/apache/superset/pull/37479#discussion_r2796428995


##########
superset-frontend/src/filters/components/Select/SelectFilterPlugin.test.tsx:
##########
@@ -680,6 +683,123 @@ describe('SelectFilterPlugin', () => {
     expect(options[1]).toHaveTextContent('alpha');
     expect(options[2]).toHaveTextContent('beta');
   });
+
+  test('allowSelectAll is disabled when searchAllOptions is enabled and data 
is truncated at 1000 rows', async () => {
+    // Create mock data with 1000 rows to simulate truncation
+    const largeData = Array.from({ length: 1000 }, (_, i) => ({
+      gender: `value_${i}`,
+    }));
+
+    getWrapper({
+      searchAllOptions: true,
+      multiSelect: true,
+      queriesData: [
+        {
+          rowcount: 1000,
+          colnames: ['gender'],
+          coltypes: [1],
+          data: largeData,
+          applied_filters: [{ column: 'gender' }],
+          rejected_filters: [],
+        },
+      ],
+    });
+
+    // Open the dropdown
+    const filterSelect = screen.getAllByRole('combobox')[0];
+    userEvent.click(filterSelect);
+
+    // Wait for dropdown to be visible
+    await waitFor(() => {
+      expect(screen.getByRole('combobox')).toBeInTheDocument();
+    });
+
+    // Verify "Select All" button is NOT present (disabled due to truncation)
+    expect(screen.queryByText(/Select all/i)).not.toBeInTheDocument();
+  });
+
+  test('allowSelectAll is enabled when searchAllOptions is enabled but data is 
less than 1000 rows', async () => {
+    getWrapper({
+      searchAllOptions: true,
+      multiSelect: true,
+    });
+
+    // Open the dropdown
+    const filterSelect = screen.getAllByRole('combobox')[0];
+    userEvent.click(filterSelect);
+
+    // Wait for dropdown to be visible
+    await waitFor(() => {
+      expect(screen.getByRole('combobox')).toBeInTheDocument();
+    });
+
+    // With only 3 rows (default test data), "Select all" button should be 
present
+<<<<<<< HEAD
+    expect(await screen.findByText(/Select all/i)).toBeInTheDocument();
+=======
+    expect(await screen.findByText('Select all (3)')).toBeInTheDocument();
+>>>>>>> 283da0ca52e60a37ff7dcadba53f3260a523bf47
+  });
+
+  test('allowSelectAll is enabled for multi-select without searchAllOptions', 
async () => {
+    getWrapper({
+      searchAllOptions: false,
+      multiSelect: true,
+    });
+
+    // Open the dropdown
+    const filterSelect = screen.getAllByRole('combobox')[0];
+    userEvent.click(filterSelect);
+
+    // Wait for dropdown to be visible
+    await waitFor(() => {
+      expect(screen.getByRole('combobox')).toBeInTheDocument();
+    });
+
+    // "Select all" button should be present for static filters
+<<<<<<< HEAD
+    expect(await screen.findByText(/Select all/i)).toBeInTheDocument();
+=======
+    expect(await screen.findByText('Select all (3)')).toBeInTheDocument();
+>>>>>>> 283da0ca52e60a37ff7dcadba53f3260a523bf47

Review Comment:
   **Suggestion:** Another unresolved merge conflict in this test leaves Git 
conflict markers and duplicate expectations, which will break parsing and 
prevent the test suite from running; keep the explicit 'Select all (3)' 
assertion and remove the markers. [possible bug]
   
   <details>
   <summary><b>Severity Level:</b> Critical 🚨</summary>
   
   ```mdx
   - ❌ Test file is syntactically invalid due to conflict markers.
   - ❌ Jest test run for superset-frontend fails immediately.
   - ❌ Static filter "Select all" behavior cannot be verified.
   - ⚠️ Blocks merging if CI enforces passing frontend tests.
   ```
   </details>
   
   ```suggestion
       expect(await screen.findByText('Select all (3)')).toBeInTheDocument();
   ```
   <details>
   <summary><b>Steps of Reproduction ✅ </b></summary>
   
   ```mdx
   1. Run the frontend test suite from `superset-frontend` (e.g. `npm test`), 
which uses Jest
   to execute `*.test.tsx` files like
   `src/filters/components/Select/SelectFilterPlugin.test.tsx`.
   
   2. Jest/babel attempts to parse `SelectFilterPlugin.test.tsx` and reaches 
the test
   `"allowSelectAll is enabled for multi-select without searchAllOptions"` 
around lines
   759–764.
   
   3. The parser hits the second unresolved merge conflict block:
   
      the comment `// "Select all" button should be present for static filters` 
followed by
      `<<<<<<< HEAD`, two conflicting `expect(...)` lines, and the `>>>>>>>
      283da0ca52e60a37ff7dcadba53f3260a523bf47` marker.
   
   4. Parsing fails with a syntax error due to these Git conflict markers, 
causing Jest to
   abort and preventing execution of this and all other tests in the same Jest 
run.
   ```
   </details>
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** 
superset-frontend/src/filters/components/Select/SelectFilterPlugin.test.tsx
   **Line:** 760:764
   **Comment:**
        *Possible Bug: Another unresolved merge conflict in this test leaves 
Git conflict markers and duplicate expectations, which will break parsing and 
prevent the test suite from running; keep the explicit 'Select all (3)' 
assertion and remove the markers.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37479&comment_hash=2d13e57624dab499f5e3cda66fbd87f4d43eedddb69a6d98981c382670c1601c&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37479&comment_hash=2d13e57624dab499f5e3cda66fbd87f4d43eedddb69a6d98981c382670c1601c&reaction=dislike'>👎</a>



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to