Skip to content

Commit

Permalink
fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Jan 9, 2025
1 parent 20203cb commit 003f992
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@
*/
import { shallow as enzymeShallow, mount as enzymeMount } from 'enzyme';
// eslint-disable-next-line no-restricted-imports
import { supersetTheme } from '@superset-ui/core';
import { ReactElement } from 'react';
import { render } from '@testing-library/react';
import { ThemeProvider, supersetTheme } from '@superset-ui/core';
import { ProviderWrapper } from './ProviderWrapper';
import '@testing-library/jest-dom';

type optionsType = {
wrappingComponentProps?: any;
Expand Down Expand Up @@ -55,3 +57,6 @@ export function styledShallow(
},
});
}

export const renderWithTheme = (component: JSX.Element) =>
render(<ThemeProvider theme={supersetTheme}>{component}</ThemeProvider>);
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import { screen, fireEvent } from '@testing-library/react';
import { renderWithTheme } from 'src/utils/testUtils';
import { renderWithTheme } from 'spec/helpers/theming';
import ErrorAlert from './ErrorAlert';

describe('ErrorAlert', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
import { ThemeProvider, supersetTheme, JsonObject } from '@superset-ui/core';
import { render } from '@testing-library/react';
import '@testing-library/jest-dom';
import { JsonObject } from '@superset-ui/core';

type TestWithIdType<T> = T extends string ? string : { 'data-test': string };

export const renderWithTheme = (component: JSX.Element) =>
render(<ThemeProvider theme={supersetTheme}>{component}</ThemeProvider>);

// using bem standard
// Using bem standard
export const testWithId =
<T extends string | JsonObject = JsonObject>(
prefix?: string,
Expand All @@ -42,7 +37,6 @@ export const testWithId =
return (resultIdOnly ? id : { 'data-test': id }) as TestWithIdType<T>;
}
if (!id && !prefix) {
// eslint-disable-next-line no-console
console.warn('testWithId function has missed "prefix" and "id" params');
return (resultIdOnly ? '' : { 'data-test': '' }) as TestWithIdType<T>;
}
Expand Down

0 comments on commit 003f992

Please sign in to comment.