mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-20 23:32:19 +00:00
feat(security): prefer digest identity in scan history (#1610)
Retain scans and History search by digest when available, keep imageRefLike for compatibility, and surface digests in compare.
This commit is contained in:
@@ -94,7 +94,7 @@ describe('ScanComparisonSheet', () => {
|
||||
render(<ScanComparisonSheet baselineScanId={1} currentScanId={2} onClose={() => {}} />);
|
||||
|
||||
await waitFor(() =>
|
||||
expect(screen.getByText(/different image references/i)).toBeInTheDocument(),
|
||||
expect(screen.getByText(/different image identities/i)).toBeInTheDocument(),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -104,7 +104,22 @@ describe('ScanComparisonSheet', () => {
|
||||
render(<ScanComparisonSheet baselineScanId={1} currentScanId={2} onClose={() => {}} />);
|
||||
|
||||
await waitFor(() => expect(screen.getByText(/Baseline/i)).toBeInTheDocument());
|
||||
expect(screen.queryByText(/different image references/i)).toBeNull();
|
||||
expect(screen.queryByText(/different image identities/i)).toBeNull();
|
||||
});
|
||||
|
||||
it('shows cross-image warning when digests differ for the same tag', async () => {
|
||||
mockedFetch.mockResolvedValueOnce(
|
||||
jsonResponse(200, result({
|
||||
scanA: { id: 1, image_ref: 'app:latest', scanned_at: 1, image_digest: 'sha256:aaa' },
|
||||
scanB: { id: 2, image_ref: 'app:latest', scanned_at: 2, image_digest: 'sha256:bbb' },
|
||||
})),
|
||||
);
|
||||
|
||||
render(<ScanComparisonSheet baselineScanId={1} currentScanId={2} onClose={() => {}} />);
|
||||
|
||||
await waitFor(() =>
|
||||
expect(screen.getByText(/different image identities/i)).toBeInTheDocument(),
|
||||
);
|
||||
});
|
||||
|
||||
it('surfaces a toast and closes the sheet on fetch error', async () => {
|
||||
|
||||
Reference in New Issue
Block a user