-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fleet] Fix displaying agent status bar with no agents (#156541)
- Loading branch information
Showing
2 changed files
with
60 additions
and
8 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
.../public/applications/fleet/sections/agents/agent_list_page/components/status_bar.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
import { createFleetTestRendererMock } from '../../../../../../mock'; | ||
|
||
import { AgentStatusBar } from './status_bar'; | ||
|
||
describe('AgentStatusBar', () => { | ||
it('should render the status bar if there is some agent displayed', () => { | ||
const renderer = createFleetTestRendererMock(); | ||
const res = renderer.render( | ||
<AgentStatusBar | ||
agentStatus={ | ||
{ | ||
healthy: 10, | ||
inactive: 0, | ||
offline: 0, | ||
} as any | ||
} | ||
/> | ||
); | ||
expect(res.queryByTestId('agentStatusBar')).not.toBeNull(); | ||
}); | ||
|
||
it('should not render the status bar if there is no agent displayed', () => { | ||
const renderer = createFleetTestRendererMock(); | ||
const res = renderer.render( | ||
<AgentStatusBar | ||
agentStatus={ | ||
{ | ||
healthy: 0, | ||
inactive: 0, | ||
offline: 0, | ||
} as any | ||
} | ||
/> | ||
); | ||
expect(res.queryByTestId('agentStatusBar')).toBeNull(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters