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.
120 lines
2.8 KiB
JavaScript
120 lines
2.8 KiB
JavaScript
/////////////////////////////////////////////////////////////
|
|
//
|
|
// pgAdmin 4 - PostgreSQL Tools
|
|
//
|
|
// Copyright (C) 2013 - 2023, The pgAdmin Development Team
|
|
// This software is released under the PostgreSQL Licence
|
|
//
|
|
//////////////////////////////////////////////////////////////
|
|
|
|
|
|
import BaseUISchema from 'sources/SchemaView/base_schema.ui';
|
|
import DomainSchema, { DomainConstSchema } from '../../../pgadmin/browser/server_groups/servers/databases/schemas/domains/static/js/domain.ui';
|
|
import {addNewDatagridRow, genericBeforeEach, getCreateView, getEditView, getPropertiesView} from '../genericFunctions';
|
|
|
|
describe('DomainSchema', ()=>{
|
|
|
|
let schemaObj = new DomainSchema(
|
|
{
|
|
role: ()=>[],
|
|
schema: ()=>[],
|
|
basetype: ()=>['character varying', 'numeric'],
|
|
collation: ()=>[],
|
|
},
|
|
[],
|
|
{
|
|
owner: 'postgres',
|
|
schema: 'public',
|
|
basensp: 'public',
|
|
}
|
|
);
|
|
let getInitData = ()=>Promise.resolve({});
|
|
|
|
|
|
|
|
|
|
|
|
beforeEach(()=>{
|
|
genericBeforeEach();
|
|
});
|
|
|
|
it('create', async ()=>{
|
|
await getCreateView(schemaObj);
|
|
});
|
|
|
|
it('edit', async ()=>{
|
|
await getEditView(schemaObj, getInitData);
|
|
});
|
|
|
|
it('properties', async ()=>{
|
|
await getPropertiesView(schemaObj, getInitData);
|
|
});
|
|
});
|
|
|
|
/* Used to check collection mode */
|
|
class MockSchema extends BaseUISchema {
|
|
constructor() {
|
|
super();
|
|
}
|
|
|
|
get baseFields() {
|
|
return [{
|
|
id: 'constraint', label: '', type: 'collection',
|
|
schema: new DomainConstSchema(),
|
|
editable: false,
|
|
group: 'Constraints', mode: ['edit', 'create'],
|
|
canAdd: true, canEdit: false, canDelete: true, hasRole: true,
|
|
node: 'role',
|
|
}];
|
|
}
|
|
}
|
|
|
|
describe('DomainConstSchema', ()=>{
|
|
|
|
let schemaObj = new MockSchema();
|
|
let domainConstObj = new DomainConstSchema();
|
|
let getInitData = ()=>Promise.resolve({});
|
|
|
|
|
|
|
|
|
|
|
|
beforeEach(()=>{
|
|
genericBeforeEach();
|
|
});
|
|
|
|
it('create', async ()=>{
|
|
const {ctrl, user} = await getCreateView(schemaObj);
|
|
|
|
/* Make sure you hit every corner */
|
|
|
|
await addNewDatagridRow(user, ctrl);
|
|
});
|
|
|
|
it('edit', async ()=>{
|
|
await getEditView(schemaObj, getInitData);
|
|
});
|
|
|
|
it('properties', async ()=>{
|
|
await getPropertiesView(schemaObj, getInitData);
|
|
});
|
|
|
|
it('validate', ()=>{
|
|
let state = {};
|
|
let setError = jest.fn();
|
|
|
|
state.conname = undefined;
|
|
domainConstObj.validate(state, setError);
|
|
expect(setError).toHaveBeenCalledWith('conname', 'Constraint Name cannot be empty.');
|
|
|
|
state.conname = 'my_syn';
|
|
state.consrc = undefined;
|
|
domainConstObj.validate(state, setError);
|
|
expect(setError).toHaveBeenCalledWith('consrc', 'Constraint Check cannot be empty.');
|
|
|
|
state.consrc = 'public';
|
|
domainConstObj.validate(state, setError);
|
|
expect(setError).toHaveBeenCalledWith('consrc', null);
|
|
});
|
|
});
|