From 9c1bd24f16211f0add745ae625c7bb8cee0ae617 Mon Sep 17 00:00:00 2001 From: hsiegeln <37154749+hsiegeln@users.noreply.github.com> Date: Thu, 23 Apr 2026 17:08:57 +0200 Subject: [PATCH] test(ui): CheckpointsTable covers fragment layout + locale sub-line --- .../CheckpointsTable.test.tsx | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/ui/src/pages/AppsTab/AppDeploymentPage/CheckpointsTable.test.tsx b/ui/src/pages/AppsTab/AppDeploymentPage/CheckpointsTable.test.tsx index b26ec90e..186bccf9 100644 --- a/ui/src/pages/AppsTab/AppDeploymentPage/CheckpointsTable.test.tsx +++ b/ui/src/pages/AppsTab/AppDeploymentPage/CheckpointsTable.test.tsx @@ -26,25 +26,27 @@ const stoppedDep: Deployment = { }; function expand() { - fireEvent.click(screen.getByRole('button', { name: /checkpoints/i })); + fireEvent.click(screen.getByRole('button', { name: /expand|collapse/i })); } describe('CheckpointsTable', () => { - it('defaults to collapsed — header visible, rows hidden', () => { + it('defaults to collapsed — label + trigger visible, rows hidden', () => { wrap( {}} />); - expect(screen.getByRole('button', { name: /checkpoints \(1\)/i })).toBeInTheDocument(); + expect(screen.getByText('Checkpoints')).toBeInTheDocument(); + expect(screen.getByRole('button', { name: /expand \(1\)/i })).toBeInTheDocument(); expect(screen.queryByText('v6')).toBeNull(); expect(screen.queryByText('my-app-1.2.3.jar')).toBeNull(); }); - it('clicking header expands to show rows', () => { + it('clicking trigger expands to show rows; label flips to Collapse', () => { wrap( {}} />); expand(); expect(screen.getByText('v6')).toBeInTheDocument(); expect(screen.getByText('my-app-1.2.3.jar')).toBeInTheDocument(); expect(screen.getByText('alice')).toBeInTheDocument(); + expect(screen.getByRole('button', { name: /collapse \(1\)/i })).toBeInTheDocument(); }); it('row click invokes onSelect with deploymentId', () => { @@ -105,4 +107,23 @@ describe('CheckpointsTable', () => { expand(); expect(screen.getByText(/show older \(5\)/i)).toBeInTheDocument(); }); + + it('Deployed sub-line is locale-formatted (not the raw ISO)', () => { + wrap( {}} />); + expand(); + // Raw ISO would contain 'T' and end in 'Z' — localized form must not. + const raw = '2026-04-23T10:35:00Z'; + expect(screen.queryByText(raw)).toBeNull(); + // Use the createdBy cell as an anchor and walk to the sibling Deployed cell. + const row = screen.getByText('alice').closest('tr')!; + const cells = row.querySelectorAll('td'); + // Column order: Version, JAR, Deployed by, Deployed, Strategy, Outcome, chevron + const deployedCell = cells[3]; + expect(deployedCell).toBeDefined(); + const text = deployedCell.textContent ?? ''; + expect(text).not.toContain('T10:35'); + expect(text).not.toContain('Z'); + expect(text.length).toBeGreaterThan(0); + }); });