///////////////////////////////////////////////////////////// // // pgAdmin 4 - PostgreSQL Tools // // Copyright (C) 2013 - 2023, The pgAdmin Development Team // This software is released under the PostgreSQL Licence // ////////////////////////////////////////////////////////////// import MembershipSchema from '../../../pgadmin/browser/server_groups/servers/static/js/membership.ui'; import * as nodeAjax from '../../../pgadmin/browser/static/js/node_ajax'; import BaseUISchema from '../../../pgadmin/static/js/SchemaView/base_schema.ui'; import {addNewDatagridRow, genericBeforeEach, getCreateView, getEditView, getPropertiesView} from '../genericFunctions'; 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, }]; } } describe('MembershipSchema', ()=>{ let schemaObj = new MembershipSchema( ()=>[]); let getInitData = ()=>Promise.resolve({}); beforeEach(()=>{ genericBeforeEach(); }); it('create', async ()=>{ await getCreateView(schemaObj); }); it('edit', async ()=>{ await getEditView(schemaObj, getInitData); }); it('properties', async ()=>{ await getPropertiesView(schemaObj, getInitData); }); it('MembershipMemberSchema', async ()=>{ jest.spyOn(nodeAjax, 'getNodeListByName').mockReturnValue([]); const {ctrl, user} = await getCreateView(new SchemaInColl(schemaObj)); /* Make sure you hit every corner */ await addNewDatagridRow(user, ctrl); }); });