mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-25 02:00:19 -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.
89 lines
2.8 KiB
JavaScript
89 lines
2.8 KiB
JavaScript
import React from 'react';
|
|
|
|
import {GraphsWrapper, X_AXIS_LENGTH, POINT_SIZE} from '../../../pgadmin/dashboard/static/js/Graphs';
|
|
import { withTheme } from '../fake_theme';
|
|
import { render, screen } from '@testing-library/react';
|
|
|
|
describe('<GraphsWrapper /> component', ()=>{
|
|
let graphComp = null;
|
|
let defaultStats = {
|
|
labels: [...Array(X_AXIS_LENGTH).keys()],
|
|
datasets: [{
|
|
label: 'Label1',
|
|
data: [],
|
|
borderColor: '#00BCD4',
|
|
backgroundColor: '#00BCD4',
|
|
pointHitRadius: POINT_SIZE,
|
|
},{
|
|
label: 'Label2',
|
|
data: [],
|
|
borderColor: '#9CCC65',
|
|
backgroundColor: '#9CCC65',
|
|
pointHitRadius: POINT_SIZE,
|
|
}],
|
|
refreshRate: 1,
|
|
};
|
|
let ThemedGraphsWrapper = withTheme(GraphsWrapper);
|
|
const compRerender = (props)=>{
|
|
graphComp.rerender(
|
|
<ThemedGraphsWrapper sessionStats={defaultStats}
|
|
tpsStats={defaultStats}
|
|
tiStats={defaultStats}
|
|
toStats={defaultStats}
|
|
bioStats={defaultStats}
|
|
errorMsg={null}
|
|
showTooltip={true}
|
|
showDataPoints={true}
|
|
lineBorderWidth={2}
|
|
isDatabase={false}
|
|
isTest={true}
|
|
{...props}
|
|
/>
|
|
);
|
|
};
|
|
beforeEach(()=>{
|
|
graphComp = render(
|
|
<ThemedGraphsWrapper sessionStats={defaultStats}
|
|
tpsStats={defaultStats}
|
|
tiStats={defaultStats}
|
|
toStats={defaultStats}
|
|
bioStats={defaultStats}
|
|
errorMsg={null}
|
|
showTooltip={true}
|
|
showDataPoints={true}
|
|
lineBorderWidth={2}
|
|
isDatabase={false}
|
|
isTest={true} />
|
|
);
|
|
});
|
|
|
|
it('graph containers are rendered', ()=>{
|
|
expect(screen.getAllByTestId('chart-container').length).toBe(5);
|
|
});
|
|
|
|
it('graph headers are correct', ()=>{
|
|
let found = screen.getAllByTestId('chart-container');
|
|
expect(found.at(0)).toHaveTextContent('Server sessions');
|
|
expect(found.at(1)).toHaveTextContent('Transactions per second');
|
|
expect(found.at(2)).toHaveTextContent('Tuples in');
|
|
expect(found.at(3)).toHaveTextContent('Tuples out');
|
|
expect(found.at(4)).toHaveTextContent('Block I/O');
|
|
});
|
|
|
|
it('graph headers when database', ()=>{
|
|
compRerender({isDatabase: true});
|
|
let found = screen.getAllByTestId('chart-container');
|
|
expect(found.at(0)).toHaveTextContent('Database sessions');
|
|
});
|
|
|
|
it('graph body shows the error', ()=>{
|
|
compRerender({errorMsg: 'Some error occurred'});
|
|
let found = screen.getAllByTestId('chart-container');
|
|
expect(found.at(0)).toHaveTextContent('Some error occurred');
|
|
expect(found.at(1)).toHaveTextContent('Some error occurred');
|
|
expect(found.at(2)).toHaveTextContent('Some error occurred');
|
|
expect(found.at(3)).toHaveTextContent('Some error occurred');
|
|
expect(found.at(4)).toHaveTextContent('Some error occurred');
|
|
});
|
|
});
|