Repository: apache/superset
File: superset-frontend/src/filters/components/Select/SelectFilterPlugin.test.tsx (TypeScript)

Code before:
          dataMask: {
            'test-filter': {
              extraFormData: {},
              filterState: {
                value: [],
                label: '',
                excludeFilterValues: true,
              },
            },
          },
        },
      },
    );

    const filterSelect = screen.getAllByRole('combobox')[0];
    userEvent.click(filterSelect);

    // When sortAscending is false and no sortMetric, options should be sorted
    // in descending alphabetical order (zebra, beta, alpha)
    const options = screen.getAllByRole('option');
    expect(options[0]).toHaveTextContent('zebra');
    expect(options[1]).toHaveTextContent('beta');
    expect(options[2]).toHaveTextContent('alpha');
  });

  test('Select boolean FALSE value in single-select mode', async () => {
    const setDataMaskMock = jest.fn();
    const testProps = {
      ...selectMultipleProps,
      formData: {
        ...selectMultipleProps.formData,
        multiSelect: false,
        groupby: ['is_active'],
      },
      queriesData: [
        {
          ...selectMultipleProps.queriesData[0],
          colnames: ['is_active'],
          data: [{ is_active: true }, { is_active: false }],
          applied_filters: [{ column: 'is_active' }],
        },
      ],
      filterState: { value: undefined },
    };

    render(
      // @ts-ignore
      <SelectFilterPlugin
        // @ts-ignore
        {...transformProps(testProps)}
        setDataMask={setDataMaskMock}

Review comment (refactor):
The codebase is migrating away from nested describe() blocks to flatten test structure. While the existing file uses the old pattern, your new test could help start this migration by being self-contained at the top level:

```
// Move this outside the describe() block, after line 680
test('Select boolean FALSE value in single-select mode', async () => {
  const setDataMaskMock = jest.fn();
  const testProps = {
    ...selectMultipleProps,  // import this const from top of file
    formData: {
      ...selectMultipleProps.formData,
      multiSelect: false,
      groupby: ['is_active'],
    },
    // ... rest of your test setup
  };
  
  // ... rest of your test
});
```

Code after:
              'test-filter': {
                name: 'Test Filter',
              },
            },
          },
          dataMask: {
            'test-filter': {
              extraFormData: {},
              filterState: {
                value: [],
                label: '',
                excludeFilterValues: true,
              },
            },
          },
        },
      },
    );

    const filterSelect = screen.getAllByRole('combobox')[0];
    userEvent.click(filterSelect);

    // When sortAscending is false and no sortMetric, options should be sorted
    // in descending alphabetical order (zebra, beta, alpha)
    const options = screen.getAllByRole('option');
    expect(options[0]).toHaveTextContent('zebra');
    expect(options[1]).toHaveTextContent('beta');
    expect(options[2]).toHaveTextContent('alpha');
  });

  test('preserves backend order even when sortAscending is false and sortMetric is specified', () => {
    const testData = [
      { gender: 'zebra' },
      { gender: 'alpha' },
      { gender: 'beta' },
    ];

    const testProps = {
      ...selectMultipleProps,
      formData: {
        ...selectMultipleProps.formData,
        sortMetric: 'count',
        sortAscending: false,
      },
      queriesData: [
        {
          rowcount: 3,
          colnames: ['gender'],
          coltypes: [1],
          data: testData,
          applied_filters: [{ column: 'gender' }],