修复:项目组分类仅补齐未分类并在完成后刷新列表
This commit is contained in:
@@ -23,22 +23,22 @@ test('blank-key source creates a narrowly scoped rule and preserves inherited de
|
||||
test('successive group and project edits accumulate without replacing other mappings or explicit empty rules',()=>{
|
||||
let result=editClassification({matchRules:[],categoryLookup:{keep:'category'}},selection,'G',defaults);
|
||||
result=editClassification(result,{kind:'projectGroup',row:{mappingType:'PROJECT_GROUP',customerCode:'001',businessGroup:'G',sourceKey:'001|G'}},'P',defaults);
|
||||
assert.equal(result.projectGroupLookup['001|G'],'P');assert.equal(result.matchRules.length,1);assert.deepEqual(result.categoryLookup,{keep:'category'});
|
||||
assert.equal(result.projectGroupLookup,undefined);assert.equal(result.matchRules.length,2);assert.equal(result.matchRules[0].target,'projectGroup');assert.equal(result.matchRules[0].onlyUnclassified,true);assert.deepEqual(result.categoryLookup,{keep:'category'});
|
||||
assert.throws(()=>editClassification(result,selection,' ',defaults));
|
||||
assert.throws(()=>editClassification(result,{kind:'projectGroup',row:{customerCode:'001',businessGroup:'G',sourceKey:'002|G'}},'P',defaults));
|
||||
});
|
||||
test('interval overrides and conflicting rule identities cannot silently mask a classification edit',()=>{
|
||||
const project={kind:'projectGroup',row:{mappingType:'PROJECT_GROUP',customerCode:'001',businessGroup:'G',sourceKey:'001|G'}};
|
||||
assert.throws(()=>editClassification({effectiveRanges:[{mappingType:'PROJECT_GROUP',sourceKey:'001|G'}]},project,'P',[]),/期间规则/);
|
||||
const ranges=[{mappingType:'PROJECT_GROUP',sourceKey:'001|G'}];assert.deepEqual(editClassification({effectiveRanges:ranges},project,'P',[]).effectiveRanges,ranges);
|
||||
const id=classificationRuleId(source);
|
||||
assert.throws(()=>editClassification({matchRules:[{id,stage:'bright',conditions:[]}]},selection,'G',[]),/冲突/);
|
||||
});
|
||||
|
||||
test('editing a disabled project relationship enables only that relationship and rejects unavailable targets',()=>{
|
||||
test('project maintenance creates only-unclassified rules without changing disabled lookups or existing classifications',()=>{
|
||||
const selection={kind:'projectGroup',row:{mappingType:'PROJECT_GROUP',customerCode:'001',businessGroup:'G',sourceKey:'001|G'}};
|
||||
const base={masterData:{projectGroups:[{code:'P',name:'项目组A',enabled:true}]},disabledMappings:{projectGroupLookup:['001|G','002|G']}};
|
||||
const result=editClassification(base,selection,'项目组A',[]);
|
||||
assert.deepEqual(result.disabledMappings.projectGroupLookup,['002|G']);
|
||||
assert.deepEqual(result.disabledMappings.projectGroupLookup,['001|G','002|G']);assert.equal(result.matchRules[0].onlyUnclassified,true);assert.equal(result.matchRules[0].target,'projectGroup');assert.deepEqual(result.matchRules[0].conditions,[{field:'客户代码',operator:'EQUALS',value:'001'},{field:'@group',operator:'EQUALS',value:'G'}]);assert.equal(editClassification(result,selection,'项目组A',[]).matchRules.length,1);
|
||||
assert.deepEqual(base.disabledMappings.projectGroupLookup,['001|G','002|G']);
|
||||
assert.throws(()=>editClassification(base,selection,'不存在的项目组',[]),/未登记/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user