storj.io/minio@v0.0.0-20230509071714-0cbc90f649b1/browser/app/js/objects/__tests__/ObjectsListContainer.test.js (about) 1 /* 2 * MinIO Cloud Storage (C) 2018 MinIO, Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 import React from "react" 18 import { shallow } from "enzyme" 19 import { ObjectsListContainer } from "../ObjectsListContainer" 20 21 describe("ObjectsList", () => { 22 it("should render without crashing", () => { 23 shallow(<ObjectsListContainer filteredObjects={[]} />) 24 }) 25 26 it("should render ObjectsList with objects", () => { 27 const wrapper = shallow( 28 <ObjectsListContainer 29 filteredObjects={[{ name: "test1.jpg" }, { name: "test2.jpg" }]} 30 /> 31 ) 32 expect(wrapper.find("ObjectsList").length).toBe(1) 33 expect(wrapper.find("ObjectsList").prop("objects")).toEqual([ 34 { name: "test1.jpg" }, 35 { name: "test2.jpg" } 36 ]) 37 }) 38 39 it("should show the loading indicator when the objects are being loaded", () => { 40 const wrapper = shallow( 41 <ObjectsListContainer 42 currentBucket="test1" 43 filteredObjects={[]} 44 listLoading={true} 45 /> 46 ) 47 expect(wrapper.find(".loading").exists()).toBeTruthy() 48 }) 49 })