Skip to content

Commit

Permalink
Added unenrolling status to frontend tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
efreeti committed Jul 20, 2020
1 parent 3092789 commit 281057f
Showing 1 changed file with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,16 @@ describe('when on the hosts page', () => {
let firstPolicyID: string;
beforeEach(() => {
reactTestingLibrary.act(() => {
const hostListData = mockHostResultList({ total: 3 });
const hostListData = mockHostResultList({ total: 4 });
firstPolicyID = hostListData.hosts[0].metadata.Endpoint.policy.applied.id;
[HostStatus.ERROR, HostStatus.ONLINE, HostStatus.OFFLINE].forEach((status, index) => {
hostListData.hosts[index] = {
metadata: hostListData.hosts[index].metadata,
host_status: status,
};
});
[HostStatus.ERROR, HostStatus.ONLINE, HostStatus.OFFLINE, HostStatus.UNENROLLING].forEach(
(status, index) => {
hostListData.hosts[index] = {
metadata: hostListData.hosts[index].metadata,
host_status: status,
};
}
);
hostListData.hosts.forEach((item, index) => {
generatedPolicyStatuses[index] = item.metadata.Endpoint.policy.applied.status;
});
Expand All @@ -134,12 +136,12 @@ describe('when on the hosts page', () => {
it('should display rows in the table', async () => {
const renderResult = render();
const rows = await renderResult.findAllByRole('row');
expect(rows).toHaveLength(4);
expect(rows).toHaveLength(5);
});
it('should show total', async () => {
const renderResult = render();
const total = await renderResult.findByTestId('hostListTableTotal');
expect(total.textContent).toEqual('3 Hosts');
expect(total.textContent).toEqual('4 Hosts');
});
it('should display correct status', async () => {
const renderResult = render();
Expand All @@ -157,6 +159,11 @@ describe('when on the hosts page', () => {
expect(
hostStatuses[2].querySelector('[data-euiicon-type][color="subdued"]')
).not.toBeNull();

expect(hostStatuses[3].textContent).toEqual('Unenrolling');
expect(
hostStatuses[3].querySelector('[data-euiicon-type][color="warning"]')
).not.toBeNull();
});

it('should display correct policy status', async () => {
Expand Down

0 comments on commit 281057f

Please sign in to comment.