1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from "react";
6 import { shallow, configure } from "enzyme";
7 import { FileThumbnail } from "./file-thumbnail";
8 import { CollectionFileType } from '../../models/collection-file';
9 import * as Adapter from 'enzyme-adapter-react-16';
11 configure({ adapter: new Adapter() });
13 jest.mock('is-image', () => ({
14 'default': () => true,
17 describe("<FileThumbnail />", () => {
23 type: CollectionFileType.FILE,
24 url: 'http://example.com/c=zzzzz-4zz18-0123456789abcde/t=v2/zzzzz-gj3su-0123456789abcde/xxxxxxtokenxxxxx/test-image.jpg',
29 it("renders file thumbnail with proper src", () => {
30 const fileThumbnail = shallow(<FileThumbnail file={file} />);
31 expect(fileThumbnail.html()).toBe('<img class="Component-thumbnail-1" alt="test-image" src="http://example.com/c=zzzzz-4zz18-0123456789abcde/test-image.jpg?api_token=v2/zzzzz-gj3su-0123456789abcde/xxxxxxtokenxxxxx"/>');