2021-07-06 14:37:51 +05:30
|
|
|
/////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
|
|
|
|
// pgAdmin 4 - PostgreSQL Tools
|
|
|
|
|
//
|
2024-01-01 14:13:48 +05:30
|
|
|
// Copyright (C) 2013 - 2024, The pgAdmin Development Team
|
2021-07-06 14:37:51 +05:30
|
|
|
// This software is released under the PostgreSQL Licence
|
|
|
|
|
//
|
|
|
|
|
//////////////////////////////////////////////////////////////
|
|
|
|
|
|
2023-10-23 17:43:17 +05:30
|
|
|
|
2021-07-06 14:37:51 +05:30
|
|
|
import ExtensionsSchema from '../../../pgadmin/browser/server_groups/servers/databases/extensions/static/js/extension.ui';
|
2022-01-28 17:20:34 +05:30
|
|
|
import {genericBeforeEach, getCreateView, getEditView, getPropertiesView} from '../genericFunctions';
|
2021-07-06 14:37:51 +05:30
|
|
|
|
|
|
|
|
describe('ExtensionSchema', ()=>{
|
2023-10-23 17:43:17 +05:30
|
|
|
|
2021-07-06 14:37:51 +05:30
|
|
|
let schemaObj = new ExtensionsSchema(
|
|
|
|
|
{
|
|
|
|
|
extensionsList: ()=>[],
|
|
|
|
|
schemaList: ()=>[],
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
let getInitData = ()=>Promise.resolve({});
|
|
|
|
|
|
|
|
|
|
|
2023-10-23 17:43:17 +05:30
|
|
|
|
|
|
|
|
|
2021-07-06 14:37:51 +05:30
|
|
|
|
|
|
|
|
beforeEach(()=>{
|
2022-01-28 17:20:34 +05:30
|
|
|
genericBeforeEach();
|
2021-07-06 14:37:51 +05:30
|
|
|
});
|
|
|
|
|
|
2023-10-23 17:43:17 +05:30
|
|
|
it('create', async ()=>{
|
|
|
|
|
await getCreateView(schemaObj);
|
2021-07-06 14:37:51 +05:30
|
|
|
});
|
|
|
|
|
|
2023-10-23 17:43:17 +05:30
|
|
|
it('edit', async ()=>{
|
|
|
|
|
await getEditView(schemaObj, getInitData);
|
2021-07-06 14:37:51 +05:30
|
|
|
});
|
|
|
|
|
|
2023-10-23 17:43:17 +05:30
|
|
|
it('properties', async ()=>{
|
|
|
|
|
await getPropertiesView(schemaObj, getInitData);
|
2021-07-06 14:37:51 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('validate', ()=>{
|
|
|
|
|
let state = {};
|
2023-10-23 17:43:17 +05:30
|
|
|
let setError = jest.fn();
|
2021-07-06 14:37:51 +05:30
|
|
|
|
|
|
|
|
state.name = null;
|
|
|
|
|
schemaObj.validate(state, setError);
|
|
|
|
|
expect(setError).toHaveBeenCalledWith('name', 'Name cannot be empty.');
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|