Skip to content

Commit a5429d6

Browse files
committed
fix(Release): add unit tests for overview tab and snapshot details view
1 parent c91faa2 commit a5429d6

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/components/Releases/__tests__/ReleaseOverviewTab.spec.tsx

+8-3
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,18 @@ jest.mock('../../../hooks/useReleases', () => ({
1919
const watchResourceMock = createK8sWatchResourceMock();
2020

2121
describe('ReleaseOverviewTab', () => {
22-
beforeEach(() => {
23-
watchResourceMock.mockReturnValue([{ spec: { application: 'test-app' } }, true]);
24-
});
22+
beforeEach(() => {});
2523

2624
createUseWorkspaceInfoMock({ namespace: 'test-ns', workspace: 'test-ws' });
2725

26+
it('should render loading indicator', () => {
27+
watchResourceMock.mockReturnValue([{ spec: { application: 'test-app' } }, false]);
28+
render(<ReleaseOverviewTab />);
29+
expect(screen.getByRole('progressbar')).toBeVisible();
30+
});
31+
2832
it('should render correct details', () => {
33+
watchResourceMock.mockReturnValue([{ spec: { application: 'test-app' } }, true]);
2934
render(<ReleaseOverviewTab />);
3035
expect(screen.getByText('Duration')).toBeVisible();
3136
expect(screen.getByText('10 seconds')).toBeVisible();

src/components/SnapshotDetails/__tests__/SnapshotDetailsView.spec.tsx

+6
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ describe('SnapshotDetailsView', () => {
6767
(useCommitStatus as jest.Mock).mockReturnValueOnce(['-', true]);
6868
});
6969

70+
it('should render loading indicator', () => {
71+
watchResourceMock.mockReturnValue([[], false]);
72+
renderWithQueryClientAndRouter(<SnapshotDetails />);
73+
screen.getByRole('progressbar');
74+
});
75+
7076
it('should show error state if test cannot be loaded', () => {
7177
watchResourceMock.mockReturnValue([
7278
[],

0 commit comments

Comments
 (0)