mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-08-04 10:01:54 +00:00
Introduce shoehorn as a possible replacement for ts-mockery
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { screen } from '@testing-library/react';
|
||||
import { Mock } from 'ts-mockery';
|
||||
import type { ShortUrl } from '../../../src/short-urls/data';
|
||||
import { fromPartial } from '@total-typescript/shoehorn';
|
||||
import { CreateShortUrlResult as createResult } from '../../../src/short-urls/helpers/CreateShortUrlResult';
|
||||
import type { ShortUrlCreation } from '../../../src/short-urls/reducers/shortUrlCreation';
|
||||
import type { TimeoutToggle } from '../../../src/utils/helpers/hooks';
|
||||
@@ -28,14 +27,14 @@ describe('<CreateShortUrlResult />', () => {
|
||||
|
||||
it('renders a result message when result is provided', () => {
|
||||
setUp(
|
||||
{ result: Mock.of<ShortUrl>({ shortUrl: 'https://s.test/abc123' }), saving: false, saved: true, error: false },
|
||||
{ result: fromPartial({ shortUrl: 'https://s.test/abc123' }), saving: false, saved: true, error: false },
|
||||
);
|
||||
expect(screen.getByText(/The short URL is/)).toHaveTextContent('Great! The short URL is https://s.test/abc123');
|
||||
});
|
||||
|
||||
it('Invokes tooltip timeout when copy to clipboard button is clicked', async () => {
|
||||
const { user } = setUp(
|
||||
{ result: Mock.of<ShortUrl>({ shortUrl: 'https://s.test/abc123' }), saving: false, saved: true, error: false },
|
||||
{ result: fromPartial({ shortUrl: 'https://s.test/abc123' }), saving: false, saved: true, error: false },
|
||||
);
|
||||
|
||||
expect(copyToClipboard).not.toHaveBeenCalled();
|
||||
|
||||
Reference in New Issue
Block a user