mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 17:40:23 +03:00
Covered short URL deletion when threshold error occurs
This commit is contained in:
parent
e6c79c19c2
commit
3dde1a5b05
1 changed files with 12 additions and 2 deletions
|
@ -4,7 +4,7 @@ import { DeleteShortUrlModal } from '../../../src/short-urls/helpers/DeleteShort
|
||||||
import { ShortUrl } from '../../../src/short-urls/data';
|
import { ShortUrl } from '../../../src/short-urls/data';
|
||||||
import { ShortUrlDeletion } from '../../../src/short-urls/reducers/shortUrlDeletion';
|
import { ShortUrlDeletion } from '../../../src/short-urls/reducers/shortUrlDeletion';
|
||||||
import { renderWithEvents } from '../../__helpers__/setUpTest';
|
import { renderWithEvents } from '../../__helpers__/setUpTest';
|
||||||
import { ProblemDetailsError } from '../../../src/api/types/errors';
|
import { ErrorTypeV2, ErrorTypeV3, InvalidShortUrlDeletion, ProblemDetailsError } from '../../../src/api/types/errors';
|
||||||
|
|
||||||
describe('<DeleteShortUrlModal />', () => {
|
describe('<DeleteShortUrlModal />', () => {
|
||||||
const shortUrl = Mock.of<ShortUrl>({
|
const shortUrl = Mock.of<ShortUrl>({
|
||||||
|
@ -33,7 +33,17 @@ describe('<DeleteShortUrlModal />', () => {
|
||||||
shortCode: 'abc123',
|
shortCode: 'abc123',
|
||||||
errorData: Mock.of<ProblemDetailsError>({ type: 'OTHER_ERROR' }),
|
errorData: Mock.of<ProblemDetailsError>({ 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<InvalidShortUrlDeletion>({ type: ErrorTypeV3.INVALID_SHORT_URL_DELETION })],
|
||||||
|
[Mock.of<InvalidShortUrlDeletion>({ 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', () => {
|
it('disables submit button when loading', () => {
|
||||||
|
|
Loading…
Reference in a new issue