@contrail/flexplm 1.7.0-alpha.c295a1e → 1.7.1-alpha.a7e0d3c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -183,7 +183,9 @@ class BaseEntityProcessor {
|
|
|
183
183
|
return undefined;
|
|
184
184
|
}
|
|
185
185
|
const entityReference = identityEntity.entityReference;
|
|
186
|
-
const
|
|
186
|
+
const firstColonIndex = entityReference.indexOf(':');
|
|
187
|
+
const entityName = entityReference.slice(0, firstColonIndex);
|
|
188
|
+
const id = entityReference.slice(firstColonIndex + 1);
|
|
187
189
|
const entity = await this.entities.get({
|
|
188
190
|
entityName,
|
|
189
191
|
id
|
|
@@ -585,5 +585,37 @@ describe('BaseEntityProcessor', () => {
|
|
|
585
585
|
id: '5'
|
|
586
586
|
});
|
|
587
587
|
});
|
|
588
|
+
it('should split entityReference on the first colon only when the id itself contains colons (project-item)', async () => {
|
|
589
|
+
const mockEntity = { id: 'e5g8ugusNWOuCvdw:nju12Jw2jGFvcQSf', name: 'Test Project Item' };
|
|
590
|
+
mockEntitiesGet
|
|
591
|
+
.mockResolvedValueOnce([{ entityReference: 'project-item:e5g8ugusNWOuCvdw:nju12Jw2jGFvcQSf' }])
|
|
592
|
+
.mockResolvedValueOnce(mockEntity);
|
|
593
|
+
const result = await btep.getEntityUsingIdentityService({
|
|
594
|
+
poolKey: 'project-item',
|
|
595
|
+
propertyName: 'itemNumber',
|
|
596
|
+
propertyValue: '12345'
|
|
597
|
+
});
|
|
598
|
+
expect(result).toEqual(mockEntity);
|
|
599
|
+
expect(mockEntitiesGet).toHaveBeenNthCalledWith(2, {
|
|
600
|
+
entityName: 'project-item',
|
|
601
|
+
id: 'e5g8ugusNWOuCvdw:nju12Jw2jGFvcQSf'
|
|
602
|
+
});
|
|
603
|
+
});
|
|
604
|
+
it('should split entityReference on the first colon only when identity result is a single object with a composite id', async () => {
|
|
605
|
+
const mockEntity = { id: 'e5g8ugusNWOuCvdw:nju12Jw2jGFvcQSf' };
|
|
606
|
+
mockEntitiesGet
|
|
607
|
+
.mockResolvedValueOnce({ entityReference: 'project-item:e5g8ugusNWOuCvdw:nju12Jw2jGFvcQSf' })
|
|
608
|
+
.mockResolvedValueOnce(mockEntity);
|
|
609
|
+
const result = await btep.getEntityUsingIdentityService({
|
|
610
|
+
poolKey: 'project-item',
|
|
611
|
+
propertyName: 'itemNumber',
|
|
612
|
+
propertyValue: '12345'
|
|
613
|
+
});
|
|
614
|
+
expect(result).toEqual(mockEntity);
|
|
615
|
+
expect(mockEntitiesGet).toHaveBeenNthCalledWith(2, {
|
|
616
|
+
entityName: 'project-item',
|
|
617
|
+
id: 'e5g8ugusNWOuCvdw:nju12Jw2jGFvcQSf'
|
|
618
|
+
});
|
|
619
|
+
});
|
|
588
620
|
});
|
|
589
621
|
});
|