Skip to content

Commit

Permalink
Tests for actions menu button to cover license level
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-tavares committed Jun 16, 2021
1 parent 71ddad3 commit c3540cc
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ import React from 'react';
import { act } from '@testing-library/react';
import { endpointPageHttpMock } from '../../../mocks';
import { fireEvent } from '@testing-library/dom';
import { licenseService } from '../../../../../../common/hooks/use_license';

jest.mock('../../../../../../common/lib/kibana');
jest.mock('../../../../../../common/hooks/use_license');

describe('When using the Endpoint Details Actions Menu', () => {
let render: () => Promise<ReturnType<AppContextTestRender['render']>>;
Expand Down Expand Up @@ -112,4 +114,21 @@ describe('When using the Endpoint Details Actions Menu', () => {
expect(coreStart.application.navigateToApp).toHaveBeenCalled();
});
});

describe('and license is NOT PlatinumPlus', () => {
(licenseService as jest.Mocked<typeof licenseService>).isPlatinumPlus.mockReturnValue(false);

it('should not show the `isoalte` action', async () => {
setEndpointMetadataResponse();
await render();
expect(renderResult.queryByTestId('isolateLink')).toBeNull();
});

it('should still show `unisolate` action for endpoints that are currently isolated', async () => {
setEndpointMetadataResponse(true);
await render();
expect(renderResult.queryByTestId('isolateLink')).toBeNull();
expect(renderResult.getByTestId('unIsolateLink')).not.toBeNull();
});
});
});

0 comments on commit c3540cc

Please sign in to comment.