diff --git a/webapp/channels/src/components/suggestion/search_suggestion_list.test.jsx b/webapp/channels/src/components/suggestion/search_suggestion_list.test.tsx similarity index 67% rename from webapp/channels/src/components/suggestion/search_suggestion_list.test.jsx rename to webapp/channels/src/components/suggestion/search_suggestion_list.test.tsx index 3016425b2c..d3067eb6b6 100644 --- a/webapp/channels/src/components/suggestion/search_suggestion_list.test.jsx +++ b/webapp/channels/src/components/suggestion/search_suggestion_list.test.tsx @@ -5,6 +5,7 @@ import React from 'react'; import {shallow} from 'enzyme'; import SearchSuggestionList from 'components/suggestion/search_suggestion_list'; +import {TestHelper} from 'utils/test_helper'; describe('components/SearchSuggestionList', () => { const baseProps = { @@ -21,6 +22,14 @@ describe('components/SearchSuggestionList', () => { }; test('should not throw error when currentLabel is null and label is generated', () => { + const userProfile = TestHelper.getUserMock(); + const item = { + ...userProfile, + type: 'item_type', + display_name: 'item_display_name', + name: 'item_name', + }; + const wrapper = shallow( { />, ); - const instance = wrapper.instance(); - instance.currentLabel = null; + const instance = wrapper.instance() as SearchSuggestionList; + instance.currentLabel = null as any; - instance.generateLabel({}); + instance.generateLabel(item); }); });