diff --git a/codecv.yml b/codecv.yml
index cf4004ac..dc965d54 100644
--- a/codecv.yml
+++ b/codecv.yml
@@ -9,7 +9,7 @@ coverage:
project:
default:
target: auto
- threshold: 0.2%
+ threshold: 1%
patch:
default:
informational: true
diff --git a/src/components/Releases/__tests__/ReleaseOverviewTab.spec.tsx b/src/components/Releases/__tests__/ReleaseOverviewTab.spec.tsx
index 2cecef66..1d55dab2 100644
--- a/src/components/Releases/__tests__/ReleaseOverviewTab.spec.tsx
+++ b/src/components/Releases/__tests__/ReleaseOverviewTab.spec.tsx
@@ -19,13 +19,18 @@ jest.mock('../../../hooks/useReleases', () => ({
const watchResourceMock = createK8sWatchResourceMock();
describe('ReleaseOverviewTab', () => {
- beforeEach(() => {
- watchResourceMock.mockReturnValue([{ spec: { application: 'test-app' } }, true]);
- });
+ beforeEach(() => {});
createUseWorkspaceInfoMock({ namespace: 'test-ns', workspace: 'test-ws' });
+ it('should render loading indicator', () => {
+ watchResourceMock.mockReturnValue([{ spec: { application: 'test-app' } }, false]);
+ render();
+ expect(screen.getByRole('progressbar')).toBeVisible();
+ });
+
it('should render correct details', () => {
+ watchResourceMock.mockReturnValue([{ spec: { application: 'test-app' } }, true]);
render();
expect(screen.getByText('Duration')).toBeVisible();
expect(screen.getByText('10 seconds')).toBeVisible();
diff --git a/src/components/SnapshotDetails/__tests__/SnapshotDetailsView.spec.tsx b/src/components/SnapshotDetails/__tests__/SnapshotDetailsView.spec.tsx
index f6567c87..16eba2f7 100644
--- a/src/components/SnapshotDetails/__tests__/SnapshotDetailsView.spec.tsx
+++ b/src/components/SnapshotDetails/__tests__/SnapshotDetailsView.spec.tsx
@@ -67,6 +67,12 @@ describe('SnapshotDetailsView', () => {
(useCommitStatus as jest.Mock).mockReturnValueOnce(['-', true]);
});
+ it('should render loading indicator', () => {
+ watchResourceMock.mockReturnValue([[], false]);
+ renderWithQueryClientAndRouter();
+ screen.getByRole('progressbar');
+ });
+
it('should show error state if test cannot be loaded', () => {
watchResourceMock.mockReturnValue([
[],
diff --git a/src/hooks/__tests__/useApplicationReleases.spec.ts b/src/hooks/__tests__/useApplicationReleases.spec.ts
index 19e3b1f2..2ef951d8 100644
--- a/src/hooks/__tests__/useApplicationReleases.spec.ts
+++ b/src/hooks/__tests__/useApplicationReleases.spec.ts
@@ -15,6 +15,32 @@ const watchResourceMock = createK8sWatchResourceMock();
const useSnapshotsMock = useApplicationSnapshots as jest.Mock;
describe('useApplicationReleases', () => {
+ it('should return empty array incase release are not loaded', () => {
+ watchResourceMock.mockReturnValue([[], false]);
+ useSnapshotsMock.mockReturnValue([
+ [{ metadata: { name: 'my-snapshot' } }, { metadata: { name: 'my-snapshot-2' } }],
+ true,
+ ]);
+
+ const { result } = renderHook(() => useApplicationReleases('test-app'));
+ const [results, loaded] = result.current;
+ expect(loaded).toEqual(false);
+ expect(results.length).toEqual(0);
+ });
+
+ it('should return empty array incase snapshots are not loaded', () => {
+ watchResourceMock.mockReturnValue([[], true]);
+ useSnapshotsMock.mockReturnValue([
+ [{ metadata: { name: 'my-snapshot' } }, { metadata: { name: 'my-snapshot-2' } }],
+ false,
+ ]);
+
+ const { result } = renderHook(() => useApplicationReleases('test-app'));
+ const [results, loaded] = result.current;
+ expect(loaded).toEqual(false);
+ expect(results.length).toEqual(0);
+ });
+
it('should only return releases that are in the application', () => {
watchResourceMock.mockReturnValue([
[