mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-22 08:46:39 -06:00
862f101772
1. Replace the current layout library wcDocker with ReactJS based rc-dock. #6479 2. Have close buttons on individual panel tabs instead of common. #2821 3. Changes in the context menu on panel tabs - Add close, close all and close others menu items. #5394 4. Allow closing all the tabs, including SQL and Properties. #4733 5. Changes in docking behaviour of different tabs based on user requests and remove lock layout menu. 6. Fix an issue where the scroll position of panels was not remembered on Firefox. #2986 7. Reset layout now will not require page refresh and is done spontaneously. 8. Use the zustand store for storing preferences instead of plain JS objects. This will help reflecting preferences immediately. 9. The above fix incorrect format (no indent) of SQL stored functions/procedures. #6720 10. New version check is moved to an async request now instead of app start to improve startup performance. 11. Remove jQuery and Bootstrap completely. 12. Replace jasmine and karma test runner with jest. Migrate all the JS test cases to jest. This will save time in writing and debugging JS tests. 13. Other important code improvements and cleanup.
101 lines
2.9 KiB
JavaScript
101 lines
2.9 KiB
JavaScript
/////////////////////////////////////////////////////////////
|
|
//
|
|
// pgAdmin 4 - PostgreSQL Tools
|
|
//
|
|
// Copyright (C) 2013 - 2023, The pgAdmin Development Team
|
|
// This software is released under the PostgreSQL Licence
|
|
//
|
|
//////////////////////////////////////////////////////////////
|
|
|
|
|
|
import React from 'react';
|
|
|
|
import { render, waitFor } from '@testing-library/react';
|
|
import Theme from '../../../pgadmin/static/js/Theme';
|
|
import MockAdapter from 'axios-mock-adapter';
|
|
import axios from 'axios';
|
|
import ProcessDetails from '../../../pgadmin/misc/bgprocess/static/js/ProcessDetails';
|
|
import { BgProcessManagerProcessState } from '../../../pgadmin/misc/bgprocess/static/js/BgProcessConstants';
|
|
import BgProcessManager from '../../../pgadmin/misc/bgprocess/static/js/BgProcessManager';
|
|
import pgAdmin from 'sources/pgadmin';
|
|
import _ from 'lodash';
|
|
|
|
|
|
const processData = {
|
|
acknowledge: null,
|
|
current_storage_dir: null,
|
|
desc: 'Doing some operation on the server \'PostgreSQL 12 (localhost:5432)\'',
|
|
details: {
|
|
cmd: '/Library/PostgreSQL/12/bin/mybin --testing',
|
|
message: 'Doing some detailed operation on the server \'PostgreSQL 12 (localhost:5432)\'...'
|
|
},
|
|
etime: null,
|
|
execution_time: 0.09,
|
|
exit_code: null,
|
|
id: '220803091429498400',
|
|
process_state: BgProcessManagerProcessState.PROCESS_STARTED,
|
|
stime: '2022-08-03T09:14:30.191940+00:00',
|
|
type_desc: 'Operation on the server',
|
|
utility_pid: 140391
|
|
};
|
|
|
|
const detailsResponse = {
|
|
err: {
|
|
done: true,
|
|
lines: [['220803091259931276', 'INFO: operation log err']],
|
|
pos: 123
|
|
},
|
|
execution_time: 1.27,
|
|
exit_code: 0,
|
|
out: {
|
|
done: true,
|
|
lines: [['220803091259931276', 'INFO: operation log out']],
|
|
pos: 123
|
|
},
|
|
start_time: '2022-08-03 09:12:59.774503 +0000'
|
|
};
|
|
|
|
describe('ProcessDetails', ()=>{
|
|
|
|
let networkMock;
|
|
|
|
beforeAll(()=>{
|
|
networkMock = new MockAdapter(axios);
|
|
let initialResp = _.cloneDeep(detailsResponse);
|
|
initialResp.err.done = false;
|
|
initialResp.out.done = false;
|
|
initialResp.exit_code = null;
|
|
networkMock.onGet(`/misc/bgprocess/${processData.id}/0/0/`).reply(200, initialResp);
|
|
networkMock.onGet(`/misc/bgprocess/${processData.id}/123/123/`).reply(200, detailsResponse);
|
|
});
|
|
|
|
afterAll(() => {
|
|
networkMock.restore();
|
|
});
|
|
|
|
beforeEach(()=>{
|
|
|
|
pgAdmin.Browser = pgAdmin.Browser || {};
|
|
pgAdmin.Browser.BgProcessManager = new BgProcessManager(pgAdmin.Browser);
|
|
});
|
|
|
|
describe('ProcessDetails', ()=>{
|
|
let ctrlMount = (props)=>{
|
|
return render(<Theme>
|
|
<ProcessDetails
|
|
data={processData}
|
|
{...props}
|
|
/>
|
|
</Theme>);
|
|
};
|
|
|
|
it('running and success', async ()=>{
|
|
let ctrl = ctrlMount({});
|
|
expect(ctrl.container.querySelector('[data-test="notifier-message"]')).toHaveTextContent('Running...');
|
|
await waitFor(()=>{
|
|
expect(ctrl.container.querySelector('[data-test="notifier-message"]')).toHaveTextContent('Successfully completed.');
|
|
}, {timeout: 2000});
|
|
});
|
|
});
|
|
});
|