diff --git a/test/short-urls/helpers/DeleteShortUrlModal.test.tsx b/test/short-urls/helpers/DeleteShortUrlModal.test.tsx index ffdfb74e..a386b198 100644 --- a/test/short-urls/helpers/DeleteShortUrlModal.test.tsx +++ b/test/short-urls/helpers/DeleteShortUrlModal.test.tsx @@ -4,7 +4,7 @@ import { DeleteShortUrlModal } from '../../../src/short-urls/helpers/DeleteShort import { ShortUrl } from '../../../src/short-urls/data'; import { ShortUrlDeletion } from '../../../src/short-urls/reducers/shortUrlDeletion'; import { renderWithEvents } from '../../__helpers__/setUpTest'; -import { ProblemDetailsError } from '../../../src/api/types/errors'; +import { ErrorTypeV2, ErrorTypeV3, InvalidShortUrlDeletion, ProblemDetailsError } from '../../../src/api/types/errors'; describe('', () => { const shortUrl = Mock.of({ @@ -33,7 +33,17 @@ describe('', () => { shortCode: 'abc123', errorData: Mock.of({ type: 'OTHER_ERROR' }), }); - expect(screen.getByText('Something went wrong while deleting the URL :(')).toBeInTheDocument(); + expect(screen.getByText('Something went wrong while deleting the URL :(').parentElement).not.toHaveClass( + 'bg-warning', + ); + }); + + it.each([ + [Mock.of({ type: ErrorTypeV3.INVALID_SHORT_URL_DELETION })], + [Mock.of({ type: ErrorTypeV2.INVALID_SHORT_URL_DELETION })], + ])('shows specific error when threshold error occurs', (errorData) => { + setUp({ loading: false, error: true, shortCode: 'abc123', errorData }); + expect(screen.getByText('Something went wrong while deleting the URL :(').parentElement).toHaveClass('bg-warning'); }); it('disables submit button when loading', () => {