Fixed jasmine test cases.

This commit is contained in:
Pradip Parkale 2021-09-21 17:42:18 +05:30 committed by Akshay Joshi
parent 6b100b60f8
commit 7330b3520f
4 changed files with 9 additions and 18 deletions

View File

@ -4,12 +4,14 @@ import BaseUISchema from 'sources/SchemaView/base_schema.ui';
import { emptyValidator, isEmptyString } from '../../../../../../../../static/js/validators'; import { emptyValidator, isEmptyString } from '../../../../../../../../static/js/validators';
export class PartitionKeysSchema extends BaseUISchema { export class PartitionKeysSchema extends BaseUISchema {
constructor(columns=[]) { constructor(columns=[], getCollations, getOperatorClass) {
super({ super({
key_type: 'column', key_type: 'column',
}); });
this.columns = columns; this.columns = columns;
this.columnsReloadBasis = false; this.columnsReloadBasis = false;
this.getCollations = getCollations;
this.getOperatorClass = getOperatorClass;
} }
changeColumnOptions(columns) { changeColumnOptions(columns) {
@ -69,7 +71,7 @@ export class PartitionKeysSchema extends BaseUISchema {
},{ },{
id: 'collationame', label: gettext('Collation'), cell: 'select', id: 'collationame', label: gettext('Collation'), cell: 'select',
type: 'select', group: gettext('partition'), deps:['key_type'], type: 'select', group: gettext('partition'), deps:['key_type'],
options: obj.top.getCollations(), mode: ['create', 'properties', 'edit'], options: obj.getCollations, mode: ['create', 'properties', 'edit'],
editable: function(state) { editable: function(state) {
if(state.key_type == 'expression') { if(state.key_type == 'expression') {
return false; return false;
@ -88,7 +90,7 @@ export class PartitionKeysSchema extends BaseUISchema {
return true; return true;
}, },
disabled: ()=>{return !(obj.isNew()); }, disabled: ()=>{return !(obj.isNew()); },
options: obj.top.getOperatorClass(), mode: ['create', 'properties', 'edit'], options: obj.getOperatorClass, mode: ['create', 'properties', 'edit'],
}]; }];
} }
@ -111,7 +113,7 @@ export class PartitionKeysSchema extends BaseUISchema {
} }
} }
export class PartitionsSchema extends BaseUISchema { export class PartitionsSchema extends BaseUISchema {
constructor(nodeInfo) { constructor(nodeInfo, getCollations, getOperatorClass) {
super({ super({
oid: undefined, oid: undefined,
is_attach: false, is_attach: false,
@ -126,7 +128,7 @@ export class PartitionsSchema extends BaseUISchema {
sub_partition_type: 'range', sub_partition_type: 'range',
}); });
this.subPartitionsObj = new PartitionKeysSchema(); this.subPartitionsObj = new PartitionKeysSchema([], getCollations, getOperatorClass);
this.nodeInfo = nodeInfo; this.nodeInfo = nodeInfo;
} }

View File

@ -309,14 +309,12 @@ export default class TableSchema extends BaseUISchema {
this.getPrivilegeRoleSchema = getPrivilegeRoleSchema; this.getPrivilegeRoleSchema = getPrivilegeRoleSchema;
this.nodeInfo = nodeInfo; this.nodeInfo = nodeInfo;
this.getColumns = getColumns; this.getColumns = getColumns;
this.getCollations = getCollations;
this.getOperatorClass = getOperatorClass;
this.partitionKeysObj = new PartitionKeysSchema(); this.partitionsObj = new PartitionsSchema(this.nodeInfo, getCollations, getOperatorClass);
this.partitionsObj = new PartitionsSchema(this.nodeInfo);
this.constraintsObj = this.schemas.constraints(); this.constraintsObj = this.schemas.constraints();
this.columnsSchema = this.schemas.columns(); this.columnsSchema = this.schemas.columns();
this.vacuumSettingsSchema = this.schemas.vacuum_settings(); this.vacuumSettingsSchema = this.schemas.vacuum_settings();
this.partitionKeysObj = new PartitionKeysSchema([], getCollations, getOperatorClass);
} }
get idAttribute() { get idAttribute() {

View File

@ -46,9 +46,6 @@ describe('PartitionTableSchema', ()=>{
} }
} }
}); });
schemaObj.top = schemaObj;
schemaObj.top.getCollations = ()=>Promise.resolve({});
schemaObj.top.getOperatorClass = ()=>Promise.resolve({});
}); });
afterAll(() => { afterAll(() => {

View File

@ -55,10 +55,6 @@ describe('PartitionKeysSchema', ()=>{
spyOn(nodeAjax, 'getNodeAjaxOptions').and.returnValue(Promise.resolve([])); spyOn(nodeAjax, 'getNodeAjaxOptions').and.returnValue(Promise.resolve([]));
spyOn(nodeAjax, 'getNodeListByName').and.returnValue(Promise.resolve([])); spyOn(nodeAjax, 'getNodeListByName').and.returnValue(Promise.resolve([]));
let partitionObj = new PartitionKeysSchema(); let partitionObj = new PartitionKeysSchema();
partitionObj.top = {
getCollations : ()=>{},
getOperatorClass : ()=>{},
};
schemaObj = new SchemaInColl(partitionObj); schemaObj = new SchemaInColl(partitionObj);
}); });
@ -171,8 +167,6 @@ describe('PartitionsSchema', ()=>{
spyOn(nodeAjax, 'getNodeListByName').and.returnValue(Promise.resolve([])); spyOn(nodeAjax, 'getNodeListByName').and.returnValue(Promise.resolve([]));
schemaObj = new PartitionsSchema(); schemaObj = new PartitionsSchema();
schemaObj.top = schemaObj; schemaObj.top = schemaObj;
schemaObj.top.getCollations = ()=>Promise.resolve({});
schemaObj.top.getOperatorClass = ()=>Promise.resolve({});
}); });
afterAll(() => { afterAll(() => {