2018-06-05 05:36:19 -05:00
|
|
|
/////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// pgAdmin 4 - PostgreSQL Tools
|
|
|
|
//
|
2024-01-01 02:43:48 -06:00
|
|
|
// Copyright (C) 2013 - 2024, The pgAdmin Development Team
|
2018-06-05 05:36:19 -05:00
|
|
|
// 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', () => {
|
2019-03-14 10:11:16 -05:00
|
|
|
expect(menuEnabledServer(undefined)).toEqual(false);
|
2018-06-05 05:36:19 -05:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
context('provided node data is null', () => {
|
|
|
|
it('returns false', () => {
|
2019-03-14 10:11:16 -05:00
|
|
|
expect(menuEnabledServer(null)).toEqual(false);
|
2018-06-05 05:36:19 -05:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
context('current node type is not of the type server', () => {
|
|
|
|
it('returns false', () => {
|
2019-03-14 10:11:16 -05:00
|
|
|
expect(menuEnabledServer({_type: 'schema'})).toEqual(false);
|
2018-06-05 05:36:19 -05:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
context('current node type is of the type server', () => {
|
|
|
|
context('is connected', () => {
|
|
|
|
it('returns true', () => {
|
|
|
|
expect(menuEnabledServer({
|
|
|
|
_type: 'server',
|
|
|
|
connected: true,
|
2019-03-14 10:11:16 -05:00
|
|
|
})).toEqual(true);
|
2018-06-05 05:36:19 -05:00
|
|
|
});
|
|
|
|
});
|
|
|
|
context('is not connected', () => {
|
|
|
|
it('returns false', () => {
|
|
|
|
expect(menuEnabledServer({
|
|
|
|
_type: 'server',
|
|
|
|
connected: false,
|
2019-03-14 10:11:16 -05:00
|
|
|
})).toEqual(false);
|
2018-06-05 05:36:19 -05:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|