X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/7437e0b4a85480fc6ca977488a5bb501e7fa1e3e..38c87aec8a898f4d1c180be6a7554523aeadcb83:/src/components/file-tree/file-thumbnail.test.tsx
diff --git a/src/components/file-tree/file-thumbnail.test.tsx b/src/components/file-tree/file-thumbnail.test.tsx
index e0d5d255..3d93c890 100644
--- a/src/components/file-tree/file-thumbnail.test.tsx
+++ b/src/components/file-tree/file-thumbnail.test.tsx
@@ -2,24 +2,34 @@
//
// SPDX-License-Identifier: AGPL-3.0
-import * as React from "react";
-import { shallow, configure } from "enzyme";
+import React from "react";
+import { configure, mount } from "enzyme";
import { FileThumbnail } from "./file-thumbnail";
import { CollectionFileType } from '../../models/collection-file';
-import * as Adapter from 'enzyme-adapter-react-16';
+import Adapter from 'enzyme-adapter-react-16';
+import { Provider } from "react-redux";
+import { combineReducers, createStore } from "redux";
configure({ adapter: new Adapter() });
-jest.mock('is-image', () => ({
- 'default': () => true,
-}));
+let store;
describe("", () => {
let file;
beforeEach(() => {
+ const initialAuthState = {
+ config: {
+ keepWebServiceUrl: 'http://example.com/',
+ keepWebInlineServiceUrl: 'http://*.collections.example.com/',
+ }
+ }
+ store = createStore(combineReducers({
+ auth: (state: any = initialAuthState, action: any) => state,
+ }));
+
file = {
- name: 'test-image',
+ name: 'test-image.jpg',
type: CollectionFileType.FILE,
url: 'http://example.com/c=zzzzz-4zz18-0123456789abcde/t=v2/zzzzz-gj3su-0123456789abcde/xxxxxxtokenxxxxx/test-image.jpg',
size: 300
@@ -27,7 +37,7 @@ describe("", () => {
});
it("renders file thumbnail with proper src", () => {
- const fileThumbnail = shallow();
- expect(fileThumbnail.html()).toBe('');
+ const fileThumbnail = mount();
+ expect(fileThumbnail.html()).toBe('');
});
});