Migrated CreateServer test to react testing library

This commit is contained in:
Alejandro Celaya
2022-05-29 12:18:21 +02:00
parent 9c611a5b13
commit 494e36c842
14 changed files with 106 additions and 100 deletions

View File

@@ -4,14 +4,14 @@ import { Tooltip } from 'reactstrap';
import { Mock } from 'ts-mockery';
import { CreateShortUrlResult as createResult } from '../../../src/short-urls/helpers/CreateShortUrlResult';
import { ShortUrl } from '../../../src/short-urls/data';
import { StateFlagTimeout } from '../../../src/utils/helpers/hooks';
import { TimeoutToggle } from '../../../src/utils/helpers/hooks';
import { Result } from '../../../src/utils/Result';
describe('<CreateShortUrlResult />', () => {
let wrapper: ShallowWrapper;
const copyToClipboard = jest.fn();
const useStateFlagTimeout = jest.fn(() => [false, copyToClipboard]) as StateFlagTimeout;
const CreateShortUrlResult = createResult(useStateFlagTimeout);
const useTimeoutToggle = jest.fn(() => [false, copyToClipboard]) as TimeoutToggle;
const CreateShortUrlResult = createResult(useTimeoutToggle);
const createWrapper = (result: ShortUrl | null = null, error = false) => {
wrapper = shallow(
<CreateShortUrlResult resetCreateShortUrl={() => {}} result={result} error={error} saving={false} />,