Highlights.test.jsx (1084B)
1 import { combineReducers, createStore } from "redux"; 2 import { INITIAL_STATE, reducers } from "common/Reducers.sys.mjs"; 3 import { Highlights } from "content-src/components/DiscoveryStreamComponents/Highlights/Highlights"; 4 import { mount } from "enzyme"; 5 import { Provider } from "react-redux"; 6 import React from "react"; 7 8 describe("Discovery Stream <Highlights>", () => { 9 let wrapper; 10 11 afterEach(() => { 12 wrapper.unmount(); 13 }); 14 15 it("should render nothing with no highlights data", () => { 16 const store = createStore(combineReducers(reducers), { ...INITIAL_STATE }); 17 18 wrapper = mount( 19 <Provider store={store}> 20 <Highlights /> 21 </Provider> 22 ); 23 24 assert.ok(wrapper.isEmptyRender()); 25 }); 26 27 it("should render highlights", () => { 28 const store = createStore(combineReducers(reducers), { 29 ...INITIAL_STATE, 30 Sections: [{ id: "highlights", enabled: true }], 31 }); 32 33 wrapper = mount( 34 <Provider store={store}> 35 <Highlights /> 36 </Provider> 37 ); 38 39 assert.lengthOf(wrapper.find(".ds-highlights"), 1); 40 }); 41 });