Skip to content

Commit df4c553

Browse files
committed
test(BannerAlert): mock Icon to expose data-name for assertions; remove reliance on non-existent DOM attribute
1 parent 383c5e1 commit df4c553

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

packages/design-system-react/src/components/BannerAlert/BannerAlert.test.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ import { BannerAlert } from './BannerAlert';
77

88
import { BannerAlertSeverity } from '.';
99

10+
jest.mock('../Icon', () => {
11+
const React = require('react');
12+
return {
13+
Icon: ({ name, color, ...rest }: any) =>
14+
React.createElement('svg', {
15+
'data-name': name,
16+
'data-testid': (rest as any)['data-testid'],
17+
className: color,
18+
}),
19+
};
20+
});
21+
1022
const ICON_TEST_ID = 'banner-alert-icon';
1123

1224
describe('BannerAlert', () => {

0 commit comments

Comments
 (0)