Skip to content

Commit 9a3da42

Browse files
committed
refactor(test): update to address eslint warnings
1 parent 98df8a6 commit 9a3da42

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

packages/react/src/Banner/Banner.test.tsx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import {cleanup, render, screen} from '@testing-library/react'
1+
import {render, screen} from '@testing-library/react'
22
import userEvent from '@testing-library/user-event'
33
import React from 'react'
4-
import {Banner, BannerVariant} from '../Banner'
4+
import {Banner} from '../Banner'
55
import {FeatureFlags} from '../FeatureFlags'
66

77
describe('Banner', () => {
@@ -169,15 +169,14 @@ describe('Banner', () => {
169169
expect(onDismiss).toHaveBeenCalledTimes(3)
170170
})
171171

172-
it('should support onDismiss for all variants', () => {
173-
const onDismiss = jest.fn()
174-
const variantTypes: BannerVariant[] = ['critical', 'info', 'success', 'upsell', 'warning']
175-
variantTypes.map(variant => {
176-
cleanup()
172+
it.each(['critical', 'info', 'success', 'upsell', 'warning'] as const)(
173+
'should support onDismiss for the %s variant',
174+
variant => {
175+
const onDismiss = jest.fn()
177176
render(<Banner title="test" description="test-description" onDismiss={onDismiss} variant={variant} />)
178-
expect(screen.queryByRole('button', {name: 'Dismiss banner'})).toBeTruthy()
179-
})
180-
})
177+
expect(screen.queryByRole('button', {name: 'Dismiss banner'})).toBeInTheDocument()
178+
},
179+
)
181180

182181
it('should pass extra props onto the container element', () => {
183182
const {container} = render(<Banner title="test" data-testid="test" />)

0 commit comments

Comments
 (0)