mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-14 11:33:51 +00:00
Move shlink-web-component tests to their own folder
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { ImageDownloader } from '../../../src/utils/services/ImageDownloader';
|
||||
import { windowMock } from '../../__mocks__/Window.mock';
|
||||
|
||||
describe('ImageDownloader', () => {
|
||||
const fetch = vi.fn();
|
||||
let imageDownloader: ImageDownloader;
|
||||
|
||||
beforeEach(() => {
|
||||
(global as any).URL = { createObjectURL: () => '' };
|
||||
|
||||
imageDownloader = new ImageDownloader(fetch, windowMock);
|
||||
});
|
||||
|
||||
it('calls URL with response type blob', async () => {
|
||||
fetch.mockResolvedValue({ blob: () => new Blob() });
|
||||
|
||||
await imageDownloader.saveImage('/foo/bar.png', 'my-image.png');
|
||||
|
||||
expect(fetch).toHaveBeenCalledWith('/foo/bar.png');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user