diff --git a/app/react/components/StatsItem.test.tsx b/app/react/components/StatsItem.test.tsx
new file mode 100644
index 0000000000..254fc8d86c
--- /dev/null
+++ b/app/react/components/StatsItem.test.tsx
@@ -0,0 +1,43 @@
+import { render, screen } from '@testing-library/react';
+
+import { ContainerStats, CPUStats, MemoryStats, NodeStats } from './StatsItem';
+
+describe('StatsItem', () => {
+ describe('NodeStats', () => {
+ it('renders node count with NODES label', () => {
+ render();
+ expect(screen.getByText('3')).toBeVisible();
+ expect(screen.getByText('NODES')).toBeVisible();
+ });
+ });
+
+ describe('CPUStats', () => {
+ it('renders CPU count with cores label', () => {
+ render();
+ expect(screen.getByText('8')).toBeVisible();
+ expect(screen.getByText('cores')).toBeVisible();
+ });
+ });
+
+ describe('MemoryStats', () => {
+ it('renders memory value with MEMORY label', () => {
+ render();
+ expect(screen.getByText('8 GB')).toBeVisible();
+ expect(screen.getByText('MEMORY')).toBeVisible();
+ });
+ });
+
+ describe('ContainerStats', () => {
+ it('renders running/total containers with a progress bar', () => {
+ render();
+ expect(screen.getByText('3')).toBeVisible();
+ expect(screen.getByText('/ 5')).toBeVisible();
+ expect(screen.getByRole('progressbar')).toBeVisible();
+ });
+
+ it('renders a progress bar when total is zero', () => {
+ render();
+ expect(screen.getByRole('progressbar')).toBeInTheDocument();
+ });
+ });
+});
diff --git a/app/react/components/StatsItem.tsx b/app/react/components/StatsItem.tsx
index d415120041..fdbaefe002 100644
--- a/app/react/components/StatsItem.tsx
+++ b/app/react/components/StatsItem.tsx
@@ -49,7 +49,9 @@ export function NodeStats({ value }: StatsProps) {
export function CPUStats({ value }: StatsProps) {
return (
- {value}
+
+ {value}
+
cores
);
@@ -82,14 +84,12 @@ export function ContainerStats({
{running}
/ {actualTotal}
- {actualTotal > 0 && (
-
- )}
+
);