diff --git a/public/app/percona/shared/components/PerconaBootstrapper/PerconaUpdateVersion/PerconaUpdateVersion.test.tsx b/public/app/percona/shared/components/PerconaBootstrapper/PerconaUpdateVersion/PerconaUpdateVersion.test.tsx index 7ac884429e6fd..45cdfe9327ed0 100644 --- a/public/app/percona/shared/components/PerconaBootstrapper/PerconaUpdateVersion/PerconaUpdateVersion.test.tsx +++ b/public/app/percona/shared/components/PerconaBootstrapper/PerconaUpdateVersion/PerconaUpdateVersion.test.tsx @@ -28,6 +28,18 @@ describe('PerconaUpdateVersion', () => { }); it('should render modal with one update', async () => { + const changeLogsAPIResponse = { + last_check: '', + updates: [ + { + version: 'PMM 3.0.1', + tag: 'string', + timestamp: '2024-09-24T09:12:31.488Z', + release_notes_url: 'http://localhost:3000', + release_notes_text: 'text1', + }, + ], + }; const state = { updates: { isLoading: false, @@ -48,9 +60,7 @@ describe('PerconaUpdateVersion', () => { }, }, }; - jest - .spyOn(UpdatesService, 'getUpdatesChangelogs') - .mockReturnValue(Promise.resolve({ ...state.updates.changeLogs })); + jest.spyOn(UpdatesService, 'getUpdatesChangelogs').mockReturnValue(Promise.resolve({ changeLogsAPIResponse })); const defaultState = configureStore().getState(); const store = configureStore({ @@ -70,6 +80,25 @@ describe('PerconaUpdateVersion', () => { }); it('should render modal with multiple updates', async () => { + const changeLogsAPIResponse = { + last_check: '', + updates: [ + { + version: 'PMM 3.0.1', + tag: 'string', + timestamp: '2024-09-24T09:12:31.488Z', + release_notes_url: 'http://localhost:3000', + release_notes_text: 'text1', + }, + { + version: 'PMM 3.0.2', + tag: 'string', + timestamp: '2024-09-24T09:12:31.488Z', + release_notes_url: 'http://localhost:3000', + release_notes_text: 'text2', + }, + ], + }; const state = { updates: { isLoading: false, @@ -97,9 +126,7 @@ describe('PerconaUpdateVersion', () => { }, }, }; - jest - .spyOn(UpdatesService, 'getUpdatesChangelogs') - .mockReturnValue(Promise.resolve({ ...state.updates.changeLogs })); + jest.spyOn(UpdatesService, 'getUpdatesChangelogs').mockReturnValue(Promise.resolve({ changeLogsAPIResponse })); const defaultState = configureStore().getState(); const store = configureStore({ diff --git a/public/app/percona/shared/components/PerconaBootstrapper/PerconaUpdateVersion/PerconaUpdateVersion.tsx b/public/app/percona/shared/components/PerconaBootstrapper/PerconaUpdateVersion/PerconaUpdateVersion.tsx index 0c18661120e03..a955b58106f8c 100644 --- a/public/app/percona/shared/components/PerconaBootstrapper/PerconaUpdateVersion/PerconaUpdateVersion.tsx +++ b/public/app/percona/shared/components/PerconaBootstrapper/PerconaUpdateVersion/PerconaUpdateVersion.tsx @@ -2,7 +2,7 @@ import React, { FC, useEffect, useState } from 'react'; import { dateTimeFormat } from '@grafana/data'; import { Modal, useStyles2, Button } from '@grafana/ui'; -import { checkUpdatesChangeLogs, UpdatesChangelogs } from 'app/percona/shared/core/reducers/updates'; +import { checkUpdatesChangeLogs, UpdatesChangeLogs } from 'app/percona/shared/core/reducers/updates'; import { getPerconaUser, getUpdatesInfo } from 'app/percona/shared/core/selectors'; import { useAppDispatch } from 'app/store/store'; import { useSelector } from 'app/types'; @@ -89,7 +89,7 @@ const PerconaUpdateVersion: FC = () => {
{Messages.newVersions}