diff --git a/ui/src/components/NodePartitionTable.js b/ui/src/components/NodePartitionTable.js
index f510efe8c3..8934d82cf3 100644
--- a/ui/src/components/NodePartitionTable.js
+++ b/ui/src/components/NodePartitionTable.js
@@ -231,7 +231,7 @@ const NodePartitionTable = ({ instanceIP }: { instanceIP: string }) => {
percentage={cell.value}
buildinLabel={`${cell.value}%`}
backgroundColor={theme.brand.primaryDark1}
- aria-label={'percentage'}
+ aria-label={`${cell.value}%`}
/>
);
diff --git a/ui/src/components/NodePartitionTable.test.js b/ui/src/components/NodePartitionTable.test.js
index 2ec75f500b..e76355a7de 100644
--- a/ui/src/components/NodePartitionTable.test.js
+++ b/ui/src/components/NodePartitionTable.test.js
@@ -90,61 +90,68 @@ const server = setupServer(
),
);
-beforeAll(() => server.listen());
-afterEach(() => server.resetHandlers());
-afterAll(() => server.close());
+describe('the system partition table', () => {
+ beforeAll(() => server.listen());
-test('the partition table', async () => {
- // Setup
+ test('displays the table', async () => {
+ // Setup
- // use fake timers to let react query retry immediately after promise failure
- jest.useFakeTimers();
- initializeProm('http://192.168.1.18:8443/api/prometheus');
- initializeAM('http://192.168.1.18:8443/api/alertmanager');
+ // use fake timers to let react query retry immediately after promise failure
+ jest.useFakeTimers();
+ initializeProm('http://192.168.1.18:8443/api/prometheus');
+ initializeAM('http://192.168.1.18:8443/api/alertmanager');
- const { getByLabelText } = render(
- ,
- );
- expect(getByLabelText('loading')).toBeInTheDocument();
+ const { getByLabelText } = render(
+ ,
+ );
+ expect(getByLabelText('loading')).toBeInTheDocument();
- // Exercise
- await waitForLoadingToFinish();
+ // Exercise
+ await waitForLoadingToFinish();
- // Verify
- expect(screen.getByLabelText('status warning')).toBeInTheDocument();
- expect(screen.getByLabelText('percentage')).toBeInTheDocument();
-});
+ // Verify
+ expect(screen.getByLabelText('status warning')).toBeInTheDocument();
+ expect(screen.getByLabelText('97%')).toBeInTheDocument();
+ expect(screen.getByText('/mnt/testpart')).toBeInTheDocument();
+ // since we use the same query, so the number of global size is the same as usage
+ expect(screen.getByText('97Bytes')).toBeInTheDocument();
+ });
+
+ afterEach(() => server.resetHandlers());
+
+ test('handles server error', async () => {
+ // S
+ jest.useFakeTimers();
+ initializeProm('http://192.168.1.18:8443/api/prometheus');
+ initializeAM('http://192.168.1.18:8443/api/alertmanager');
+ // override the default route with error status
+ server.use(
+ rest.get(
+ 'http://192.168.1.18:8443/api/prometheus/api/v1/query',
+ (req, res, ctx) => {
+ return res(ctx.status(500));
+ },
+ ),
+ rest.get(
+ 'http://192.168.1.18:8443/api/alertmanager/api/v2/alerts',
+ (req, res, ctx) => {
+ return res(ctx.status(500));
+ },
+ ),
+ );
+ const { getByLabelText } = render(
+ ,
+ );
+ expect(getByLabelText('loading')).toBeInTheDocument();
-test('handles server error', async () => {
- // S
- jest.useFakeTimers();
- initializeProm('http://192.168.1.18:8443/api/prometheus');
- initializeAM('http://192.168.1.18:8443/api/alertmanager');
- // override the default route with error status
- server.use(
- rest.get(
- 'http://192.168.1.18:8443/api/prometheus/api/v1/query',
- (req, res, ctx) => {
- return res(ctx.status(500));
- },
- ),
- rest.get(
- 'http://192.168.1.18:8443/api/alertmanager/api/v2/alerts',
- (req, res, ctx) => {
- return res(ctx.status(500));
- },
- ),
- );
- const { getByLabelText } = render(
- ,
- );
- expect(getByLabelText('loading')).toBeInTheDocument();
+ // E
+ await waitForLoadingToFinish();
- // E
- await waitForLoadingToFinish();
+ // V
+ expect(
+ screen.getByText('System partitions request has failed.'),
+ ).toBeInTheDocument();
+ });
- // V
- expect(
- screen.getByText('System partitions request has failed.'),
- ).toBeInTheDocument();
+ afterAll(() => server.close());
});