[MM-23411]: Migrate "components/suggestion/search_suggestion_list.test.jsx" to Typescript (#23671)

This commit is contained in:
Muxing Lin 2023-06-20 03:43:30 -07:00 committed by GitHub
parent ef3a772836
commit df43ee60e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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(
<SearchSuggestionList
{...baseProps}
@ -28,9 +37,9 @@ describe('components/SearchSuggestionList', () => {
/>,
);
const instance = wrapper.instance();
instance.currentLabel = null;
const instance = wrapper.instance() as SearchSuggestionList;
instance.currentLabel = null as any;
instance.generateLabel({});
instance.generateLabel(item);
});
});