mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-22 08:46:39 -06:00
7dd6372eeb
Extract some of the ACI Tree functionalities, and decouple it from the main source. Also - create some abstractions from the repeated code around the enable/disable the schema children object create/edit/delete functionalities, and also created the dialog wrappers for backup and restore dialogs. Reviewed by: Khushboo and Ashesh Refactored by: Ashesh
56 lines
1.5 KiB
JavaScript
56 lines
1.5 KiB
JavaScript
/////////////////////////////////////////////////////////////
|
|
//
|
|
// pgAdmin 4 - PostgreSQL Tools
|
|
//
|
|
// Copyright (C) 2013 - 2018, The pgAdmin Development Team
|
|
// This software is released under the PostgreSQL Licence
|
|
//
|
|
//////////////////////////////////////////////////////////////
|
|
|
|
|
|
import {menuEnabledServer} from '../../../pgadmin/tools/backup/static/js/menu_utils';
|
|
|
|
const context = describe;
|
|
|
|
describe('backup.menuUtils', () => {
|
|
describe('#menuEnabledServer', () => {
|
|
context('provided node data is undefined', () => {
|
|
it('returns false', () => {
|
|
expect(menuEnabledServer(undefined)).toBe(false);
|
|
});
|
|
});
|
|
|
|
context('provided node data is null', () => {
|
|
it('returns false', () => {
|
|
expect(menuEnabledServer(null)).toBe(false);
|
|
});
|
|
});
|
|
|
|
context('current node type is not of the type server', () => {
|
|
it('returns false', () => {
|
|
expect(menuEnabledServer({_type: 'schema'})).toBe(false);
|
|
});
|
|
});
|
|
|
|
context('current node type is of the type server', () => {
|
|
context('is connected', () => {
|
|
it('returns true', () => {
|
|
expect(menuEnabledServer({
|
|
_type: 'server',
|
|
connected: true,
|
|
})).toBe(true);
|
|
});
|
|
});
|
|
context('is not connected', () => {
|
|
it('returns false', () => {
|
|
expect(menuEnabledServer({
|
|
_type: 'server',
|
|
connected: false,
|
|
})).toBe(false);
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|