Skip to content

Commit

Permalink
Address feedback from Pierre
Browse files Browse the repository at this point in the history
- Actually remove unnecessary license optional chaining (whoops)
- Have to update engines overview test with a mock license to make up for it
  • Loading branch information
cee-chen committed Jul 8, 2020
1 parent 9c6acdd commit 054f659
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('EngineOverview', () => {
const wrapper: Cheerio = render(
<I18nProvider>
<KibanaContext.Provider value={{ http: {} }}>
<LicenseContext.Provider value={{ license: {} }}>
<LicenseContext.Provider value={{ license: { isActive: false, type: 'trial' } }}>
<EngineOverview />
</LicenseContext.Provider>
</KibanaContext.Provider>
Expand Down Expand Up @@ -158,7 +158,10 @@ describe('EngineOverview', () => {
// TBH, I don't fully understand why since Enzyme's mount is supposed to
// have act() baked in - could be because of the wrapping context provider?
await act(async () => {
wrapper = mountWithContext(<EngineOverview />, { http: httpMock, license });
wrapper = mountWithContext(<EngineOverview />, {
http: httpMock,
license: license || { isActive: false, type: 'trial' },
});
});
if (wrapper) {
wrapper.update(); // This seems to be required for the DOM to actually update
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
import { ILicense } from '../../../../../licensing/public';

export const hasPlatinumLicense = (license: ILicense) => {
return license?.isActive && ['platinum', 'enterprise', 'trial'].includes(license?.type as string);
return license.isActive && ['platinum', 'enterprise', 'trial'].includes(license.type as string);
};

0 comments on commit 054f659

Please sign in to comment.