mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Port Backup Global, Backup Server, and Backup object dialog in React. Fixes #6984
This commit is contained in:
committed by
Akshay Joshi
parent
a701e8c766
commit
3afeb8ca46
96
web/regression/javascript/schema_ui_files/backup.ui.spec.js
Normal file
96
web/regression/javascript/schema_ui_files/backup.ui.spec.js
Normal file
@@ -0,0 +1,96 @@
|
||||
/////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin 4 - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2013 - 2021, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
import React from 'react';
|
||||
import '../helper/enzyme.helper';
|
||||
import { createMount } from '@material-ui/core/test-utils';
|
||||
import pgAdmin from 'sources/pgadmin';
|
||||
import SchemaView from '../../../pgadmin/static/js/SchemaView';
|
||||
import BackupSchema, {getSectionSchema, getTypeObjSchema, getSaveOptSchema, getQueryOptionSchema, getDisabledOptionSchema, getMiscellaneousSchema} from '../../../pgadmin/tools/backup/static/js/backup.ui';
|
||||
|
||||
|
||||
describe('BackupSchema', ()=>{
|
||||
let mount;
|
||||
beforeAll(()=>{
|
||||
mount = createMount();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
mount.cleanUp();
|
||||
});
|
||||
let backupSchemaObj = new BackupSchema(
|
||||
()=> getSectionSchema(),
|
||||
()=> getTypeObjSchema(),
|
||||
()=> getSaveOptSchema({nodeInfo: {server: {version: 11000}}}),
|
||||
()=> getQueryOptionSchema({nodeInfo: {server: {version: 11000}}}),
|
||||
()=> getDisabledOptionSchema({nodeInfo: {server: {version: 11000}}}),
|
||||
()=> getMiscellaneousSchema({nodeInfo: {server: {version: 11000}}}),
|
||||
{
|
||||
role: ()=>[],
|
||||
encoding: ()=>[],
|
||||
},
|
||||
{server: {version: 11000}},
|
||||
pgAdmin.pgBrowser,
|
||||
'backup_objects'
|
||||
);
|
||||
|
||||
it('create object backup', ()=>{
|
||||
mount(<SchemaView
|
||||
formType='dialog'
|
||||
schema={backupSchemaObj}
|
||||
viewHelperProps={{
|
||||
mode: 'create',
|
||||
}}
|
||||
onSave={()=>{}}
|
||||
onClose={()=>{}}
|
||||
onHelp={()=>{}}
|
||||
onDataChange={()=>{}}
|
||||
confirmOnCloseReset={false}
|
||||
hasSQL={false}
|
||||
disableSqlHelp={false}
|
||||
disableDialogHelp={false}
|
||||
/>);
|
||||
});
|
||||
|
||||
|
||||
let backupServerSchemaObj = new BackupSchema(
|
||||
()=> getSectionSchema(),
|
||||
()=> getTypeObjSchema(),
|
||||
()=> getSaveOptSchema({nodeInfo: {server: {version: 11000}}}),
|
||||
()=> getQueryOptionSchema({nodeInfo: {server: {version: 11000}}}),
|
||||
()=> getDisabledOptionSchema({nodeInfo: {server: {version: 11000}}}),
|
||||
()=> getMiscellaneousSchema({nodeInfo: {server: {version: 11000}}}),
|
||||
{
|
||||
role: ()=>[],
|
||||
encoding: ()=>[],
|
||||
},
|
||||
{server: {version: 11000}},
|
||||
{serverInfo: {}},
|
||||
'server'
|
||||
);
|
||||
|
||||
it('create server backup', ()=>{
|
||||
mount(<SchemaView
|
||||
formType='dialog'
|
||||
schema={backupServerSchemaObj}
|
||||
viewHelperProps={{
|
||||
mode: 'create',
|
||||
}}
|
||||
onSave={()=>{}}
|
||||
onClose={()=>{}}
|
||||
onHelp={()=>{}}
|
||||
onDataChange={()=>{}}
|
||||
confirmOnCloseReset={false}
|
||||
hasSQL={false}
|
||||
disableSqlHelp={false}
|
||||
disableDialogHelp={false}
|
||||
/>);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
/////////////////////////////////////////////////////////////
|
||||
//
|
||||
// pgAdmin 4 - PostgreSQL Tools
|
||||
//
|
||||
// Copyright (C) 2013 - 2021, The pgAdmin Development Team
|
||||
// This software is released under the PostgreSQL Licence
|
||||
//
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
import React from 'react';
|
||||
import '../helper/enzyme.helper';
|
||||
import { createMount } from '@material-ui/core/test-utils';
|
||||
import SchemaView from '../../../pgadmin/static/js/SchemaView';
|
||||
import BackupGlobalSchema, {getMiscellaneousSchema} from '../../../pgadmin/tools/backup/static/js/backupGlobal.ui';
|
||||
|
||||
|
||||
describe('BackupGlobalSchema', ()=>{
|
||||
let mount;
|
||||
beforeAll(()=>{
|
||||
mount = createMount();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
mount.cleanUp();
|
||||
});
|
||||
let backupGlobalSchemaObj = new BackupGlobalSchema(
|
||||
()=> getMiscellaneousSchema(),
|
||||
{
|
||||
role: ()=>[],
|
||||
}
|
||||
);
|
||||
|
||||
it('create', ()=>{
|
||||
mount(<SchemaView
|
||||
formType='dialog'
|
||||
schema={backupGlobalSchemaObj}
|
||||
viewHelperProps={{
|
||||
mode: 'create',
|
||||
}}
|
||||
onSave={()=>{}}
|
||||
onClose={()=>{}}
|
||||
onHelp={()=>{}}
|
||||
onDataChange={()=>{}}
|
||||
confirmOnCloseReset={false}
|
||||
hasSQL={false}
|
||||
disableSqlHelp={false}
|
||||
disableDialogHelp={false}
|
||||
/>);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user