2021-08-10 02:13:51 -05:00
|
|
|
/////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// pgAdmin 4 - PostgreSQL Tools
|
|
|
|
//
|
2024-01-01 02:43:48 -06:00
|
|
|
// Copyright (C) 2013 - 2024, The pgAdmin Development Team
|
2021-08-10 02:13:51 -05:00
|
|
|
// This software is released under the PostgreSQL Licence
|
|
|
|
//
|
|
|
|
//////////////////////////////////////////////////////////////
|
|
|
|
|
2023-10-23 07:13:17 -05:00
|
|
|
|
2021-08-24 03:10:37 -05:00
|
|
|
import MembershipSchema from '../../../pgadmin/browser/server_groups/servers/static/js/membership.ui';
|
2021-08-10 02:13:51 -05:00
|
|
|
import * as nodeAjax from '../../../pgadmin/browser/static/js/node_ajax';
|
2021-08-24 03:10:37 -05:00
|
|
|
import BaseUISchema from '../../../pgadmin/static/js/SchemaView/base_schema.ui';
|
2023-10-23 07:13:17 -05:00
|
|
|
import {addNewDatagridRow, genericBeforeEach, getCreateView, getEditView, getPropertiesView} from '../genericFunctions';
|
2021-08-24 03:10:37 -05:00
|
|
|
|
|
|
|
class SchemaInColl extends BaseUISchema {
|
|
|
|
constructor(schemaObj) {
|
|
|
|
super();
|
|
|
|
this.schemaObj = schemaObj;
|
|
|
|
}
|
|
|
|
|
|
|
|
get baseFields() {
|
|
|
|
return [{
|
|
|
|
id: 'collection', label: '', type: 'collection',
|
|
|
|
schema: this.schemaObj,
|
|
|
|
editable: false,
|
|
|
|
canAdd: true, canEdit: false, canDelete: true, hasRole: true,
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
}
|
2021-08-10 02:13:51 -05:00
|
|
|
|
2021-08-23 06:01:13 -05:00
|
|
|
describe('MembershipSchema', ()=>{
|
2023-10-23 07:13:17 -05:00
|
|
|
|
2021-08-10 02:13:51 -05:00
|
|
|
let schemaObj = new MembershipSchema(
|
|
|
|
()=>[]);
|
|
|
|
let getInitData = ()=>Promise.resolve({});
|
|
|
|
|
|
|
|
|
2023-10-23 07:13:17 -05:00
|
|
|
|
|
|
|
|
2021-08-10 02:13:51 -05:00
|
|
|
|
|
|
|
beforeEach(()=>{
|
2022-01-28 05:50:34 -06:00
|
|
|
genericBeforeEach();
|
2021-08-10 02:13:51 -05:00
|
|
|
});
|
|
|
|
|
2023-10-23 07:13:17 -05:00
|
|
|
it('create', async ()=>{
|
|
|
|
await getCreateView(schemaObj);
|
2021-08-10 02:13:51 -05:00
|
|
|
});
|
|
|
|
|
2023-10-23 07:13:17 -05:00
|
|
|
it('edit', async ()=>{
|
|
|
|
await getEditView(schemaObj, getInitData);
|
2021-08-10 02:13:51 -05:00
|
|
|
});
|
|
|
|
|
2023-10-23 07:13:17 -05:00
|
|
|
it('properties', async ()=>{
|
|
|
|
await getPropertiesView(schemaObj, getInitData);
|
2021-08-10 02:13:51 -05:00
|
|
|
});
|
|
|
|
|
2023-10-23 07:13:17 -05:00
|
|
|
it('MembershipMemberSchema', async ()=>{
|
|
|
|
jest.spyOn(nodeAjax, 'getNodeListByName').mockReturnValue([]);
|
|
|
|
const {ctrl, user} = await getCreateView(new SchemaInColl(schemaObj));
|
2021-08-10 02:13:51 -05:00
|
|
|
/* Make sure you hit every corner */
|
2023-10-23 07:13:17 -05:00
|
|
|
|
|
|
|
await addNewDatagridRow(user, ctrl);
|
2021-08-10 02:13:51 -05:00
|
|
|
});
|
|
|
|
});
|