mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed code smell 'Update this function so that its implementation is not identical' reported by SonarQube.
This commit is contained in:
@@ -7,14 +7,10 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
import jasmineEnzyme from 'jasmine-enzyme';
|
||||
import React from 'react';
|
||||
import '../helper/enzyme.helper';
|
||||
import { createMount } from '@material-ui/core/test-utils';
|
||||
import pgAdmin from 'sources/pgadmin';
|
||||
import {messages} from '../fake_messages';
|
||||
import SchemaView from '../../../pgadmin/static/js/SchemaView';
|
||||
import TriggerSchema, { EventSchema } from '../../../pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/static/js/trigger.ui';
|
||||
import {genericBeforeEach, getCreateView, getEditView, getPropertiesView} from '../genericFunctions';
|
||||
|
||||
describe('TriggerSchema', ()=>{
|
||||
let mount;
|
||||
@@ -42,61 +38,19 @@ describe('TriggerSchema', ()=>{
|
||||
});
|
||||
|
||||
beforeEach(()=>{
|
||||
jasmineEnzyme();
|
||||
/* messages used by validators */
|
||||
pgAdmin.Browser = pgAdmin.Browser || {};
|
||||
pgAdmin.Browser.messages = pgAdmin.Browser.messages || messages;
|
||||
pgAdmin.Browser.utils = pgAdmin.Browser.utils || {};
|
||||
genericBeforeEach();
|
||||
});
|
||||
|
||||
it('create', ()=>{
|
||||
mount(<SchemaView
|
||||
formType='dialog'
|
||||
schema={schemaObj}
|
||||
viewHelperProps={{
|
||||
mode: 'create',
|
||||
}}
|
||||
onSave={()=>{/*This is intentional (SonarQube)*/}}
|
||||
onClose={()=>{/*This is intentional (SonarQube)*/}}
|
||||
onHelp={()=>{/*This is intentional (SonarQube)*/}}
|
||||
onEdit={()=>{/*This is intentional (SonarQube)*/}}
|
||||
onDataChange={()=>{/*This is intentional (SonarQube)*/}}
|
||||
confirmOnCloseReset={false}
|
||||
hasSQL={false}
|
||||
disableSqlHelp={false}
|
||||
/>);
|
||||
mount(getCreateView(schemaObj));
|
||||
});
|
||||
|
||||
it('edit', ()=>{
|
||||
mount(<SchemaView
|
||||
formType='dialog'
|
||||
schema={schemaObj}
|
||||
getInitData={getInitData}
|
||||
viewHelperProps={{
|
||||
mode: 'edit',
|
||||
}}
|
||||
onSave={()=>{/*This is intentional (SonarQube)*/}}
|
||||
onClose={()=>{/*This is intentional (SonarQube)*/}}
|
||||
onHelp={()=>{/*This is intentional (SonarQube)*/}}
|
||||
onEdit={()=>{/*This is intentional (SonarQube)*/}}
|
||||
onDataChange={()=>{/*This is intentional (SonarQube)*/}}
|
||||
confirmOnCloseReset={false}
|
||||
hasSQL={false}
|
||||
disableSqlHelp={false}
|
||||
/>);
|
||||
mount(getEditView(schemaObj, getInitData));
|
||||
});
|
||||
|
||||
it('properties', ()=>{
|
||||
mount(<SchemaView
|
||||
formType='tab'
|
||||
schema={schemaObj}
|
||||
getInitData={getInitData}
|
||||
viewHelperProps={{
|
||||
mode: 'properties',
|
||||
}}
|
||||
onHelp={()=>{/*This is intentional (SonarQube)*/}}
|
||||
onEdit={()=>{/*This is intentional (SonarQube)*/}}
|
||||
/>);
|
||||
mount(getPropertiesView(schemaObj, getInitData));
|
||||
});
|
||||
|
||||
it('validate', ()=>{
|
||||
@@ -125,21 +79,7 @@ describe('TriggerSchema', ()=>{
|
||||
}
|
||||
);
|
||||
|
||||
mount(<SchemaView
|
||||
formType='dialog'
|
||||
schema={catalogSchemaObj}
|
||||
viewHelperProps={{
|
||||
mode: 'create',
|
||||
}}
|
||||
onSave={()=>{/*This is intentional (SonarQube)*/}}
|
||||
onClose={()=>{/*This is intentional (SonarQube)*/}}
|
||||
onHelp={()=>{/*This is intentional (SonarQube)*/}}
|
||||
onEdit={()=>{/*This is intentional (SonarQube)*/}}
|
||||
onDataChange={()=>{/*This is intentional (SonarQube)*/}}
|
||||
confirmOnCloseReset={false}
|
||||
hasSQL={false}
|
||||
disableSqlHelp={false}
|
||||
/>);
|
||||
mount(getCreateView(catalogSchemaObj));
|
||||
});
|
||||
|
||||
it('catalog properties', ()=>{
|
||||
@@ -155,16 +95,7 @@ describe('TriggerSchema', ()=>{
|
||||
}
|
||||
);
|
||||
|
||||
mount(<SchemaView
|
||||
formType='tab'
|
||||
schema={catalogPropertiesSchemaObj}
|
||||
getInitData={getInitData}
|
||||
viewHelperProps={{
|
||||
mode: 'properties',
|
||||
}}
|
||||
onHelp={()=>{/*This is intentional (SonarQube)*/}}
|
||||
onEdit={()=>{/*This is intentional (SonarQube)*/}}
|
||||
/>);
|
||||
mount(getPropertiesView(catalogPropertiesSchemaObj, getInitData));
|
||||
});
|
||||
|
||||
it('edit disableTransition', ()=>{
|
||||
@@ -190,22 +121,7 @@ describe('TriggerSchema', ()=>{
|
||||
fires: 'AFTER'
|
||||
});
|
||||
|
||||
mount(<SchemaView
|
||||
formType='dialog'
|
||||
schema={editSchemaObj}
|
||||
getInitData={initData}
|
||||
viewHelperProps={{
|
||||
mode: 'edit',
|
||||
}}
|
||||
onSave={()=>{/*This is intentional (SonarQube)*/}}
|
||||
onClose={()=>{/*This is intentional (SonarQube)*/}}
|
||||
onHelp={()=>{/*This is intentional (SonarQube)*/}}
|
||||
onEdit={()=>{/*This is intentional (SonarQube)*/}}
|
||||
onDataChange={()=>{/*This is intentional (SonarQube)*/}}
|
||||
confirmOnCloseReset={false}
|
||||
hasSQL={false}
|
||||
disableSqlHelp={false}
|
||||
/>);
|
||||
mount(getEditView(editSchemaObj, initData));
|
||||
});
|
||||
|
||||
it('edit disableTransition tgnewtable', ()=>{
|
||||
@@ -231,22 +147,7 @@ describe('TriggerSchema', ()=>{
|
||||
fires: 'AFTER'
|
||||
});
|
||||
|
||||
mount(<SchemaView
|
||||
formType='dialog'
|
||||
schema={editSchemaObj}
|
||||
getInitData={initData}
|
||||
viewHelperProps={{
|
||||
mode: 'edit',
|
||||
}}
|
||||
onSave={()=>{/*This is intentional (SonarQube)*/}}
|
||||
onClose={()=>{/*This is intentional (SonarQube)*/}}
|
||||
onHelp={()=>{/*This is intentional (SonarQube)*/}}
|
||||
onEdit={()=>{/*This is intentional (SonarQube)*/}}
|
||||
onDataChange={()=>{/*This is intentional (SonarQube)*/}}
|
||||
confirmOnCloseReset={false}
|
||||
hasSQL={false}
|
||||
disableSqlHelp={false}
|
||||
/>);
|
||||
mount(getEditView(editSchemaObj, initData));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -275,61 +176,19 @@ describe('TriggerEventsSchema', ()=>{
|
||||
});
|
||||
|
||||
beforeEach(()=>{
|
||||
jasmineEnzyme();
|
||||
/* messages used by validators */
|
||||
pgAdmin.Browser = pgAdmin.Browser || {};
|
||||
pgAdmin.Browser.messages = pgAdmin.Browser.messages || messages;
|
||||
pgAdmin.Browser.utils = pgAdmin.Browser.utils || {};
|
||||
genericBeforeEach();
|
||||
});
|
||||
|
||||
it('create', ()=>{
|
||||
mount(<SchemaView
|
||||
formType='dialog'
|
||||
schema={schemaObj}
|
||||
viewHelperProps={{
|
||||
mode: 'create',
|
||||
}}
|
||||
onSave={()=>{/*This is intentional (SonarQube)*/}}
|
||||
onClose={()=>{/*This is intentional (SonarQube)*/}}
|
||||
onHelp={()=>{/*This is intentional (SonarQube)*/}}
|
||||
onEdit={()=>{/*This is intentional (SonarQube)*/}}
|
||||
onDataChange={()=>{/*This is intentional (SonarQube)*/}}
|
||||
confirmOnCloseReset={false}
|
||||
hasSQL={false}
|
||||
disableSqlHelp={false}
|
||||
/>);
|
||||
mount(getCreateView(schemaObj));
|
||||
});
|
||||
|
||||
it('properties', ()=>{
|
||||
mount(<SchemaView
|
||||
formType='tab'
|
||||
schema={schemaObj}
|
||||
getInitData={getInitData}
|
||||
viewHelperProps={{
|
||||
mode: 'properties',
|
||||
}}
|
||||
onHelp={()=>{/*This is intentional (SonarQube)*/}}
|
||||
onEdit={()=>{/*This is intentional (SonarQube)*/}}
|
||||
/>);
|
||||
mount(getPropertiesView(schemaObj, getInitData));
|
||||
});
|
||||
|
||||
it('edit', ()=>{
|
||||
mount(<SchemaView
|
||||
formType='dialog'
|
||||
schema={schemaObj}
|
||||
getInitData={getInitData}
|
||||
viewHelperProps={{
|
||||
mode: 'edit',
|
||||
}}
|
||||
onSave={()=>{/*This is intentional (SonarQube)*/}}
|
||||
onClose={()=>{/*This is intentional (SonarQube)*/}}
|
||||
onHelp={()=>{/*This is intentional (SonarQube)*/}}
|
||||
onEdit={()=>{/*This is intentional (SonarQube)*/}}
|
||||
onDataChange={()=>{/*This is intentional (SonarQube)*/}}
|
||||
confirmOnCloseReset={false}
|
||||
hasSQL={false}
|
||||
disableSqlHelp={false}
|
||||
/>);
|
||||
mount(getEditView(schemaObj, getInitData));
|
||||
});
|
||||
|
||||
it('validate', ()=>{
|
||||
|
||||
Reference in New Issue
Block a user