Skip to content

Commit

Permalink
Check platinum license (elastic#114549)
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonStoltz authored and kibanamachine committed Oct 12, 2021
1 parent 0f15cce commit 6010ad9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import { shallow } from 'enzyme';

import { CurationsTable, EmptyState } from '../components';

import { SuggestionsTable } from '../components/suggestions_table';

import { CurationsOverview } from './curations_overview';

describe('CurationsOverview', () => {
Expand Down Expand Up @@ -44,4 +46,18 @@ describe('CurationsOverview', () => {

expect(wrapper.find(CurationsTable)).toHaveLength(1);
});

it('renders a suggestions table when the user has a platinum license', () => {
setMockValues({ curations: [], hasPlatinumLicense: true });
const wrapper = shallow(<CurationsOverview />);

expect(wrapper.find(SuggestionsTable).exists()).toBe(true);
});

it('doesn\t render a suggestions table when the user has no platinum license', () => {
setMockValues({ curations: [], hasPlatinumLicense: false });
const wrapper = shallow(<CurationsOverview />);

expect(wrapper.find(SuggestionsTable).exists()).toBe(false);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ import { useValues } from 'kea';

import { EuiSpacer } from '@elastic/eui';

import { LicensingLogic } from '../../../../shared/licensing';
import { CurationsTable, EmptyState } from '../components';
import { SuggestionsTable } from '../components/suggestions_table';
import { CurationsLogic } from '../curations_logic';

export const CurationsOverview: React.FC = () => {
const { curations } = useValues(CurationsLogic);
const { hasPlatinumLicense } = useValues(LicensingLogic);

// TODO
const shouldShowSuggestions = true;
const shouldShowSuggestions = hasPlatinumLicense;

return (
<>
Expand Down

0 comments on commit 6010ad9

Please sign in to comment.