mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-10-07 02:58:02 +00:00
test(ruby): pin factory ownership by node id
This commit is contained in:
parent
9046175902
commit
624f44bc59
1 changed files with 11 additions and 8 deletions
|
|
@ -69,23 +69,26 @@ end
|
|||
});
|
||||
|
||||
it.each([
|
||||
['StructType', 'Struct', 'struct_method'],
|
||||
['DataType', 'Class', 'data_method'],
|
||||
['ClassType', 'Class', 'class_method'],
|
||||
['ModuleType', 'Trait', 'module_method'],
|
||||
['BraceType', 'Class', 'brace_method'],
|
||||
['StructType', 'Struct', 'struct_method', 'Outer.StructType'],
|
||||
['DataType', 'Class', 'data_method', 'Outer.DataType'],
|
||||
['ClassType', 'Class', 'class_method', 'Outer.ClassType'],
|
||||
['ModuleType', 'Trait', 'module_method', 'Outer.ModuleType'],
|
||||
['BraceType', 'Class', 'brace_method', 'Outer.BraceType'],
|
||||
])(
|
||||
'materializes %s as a %s and attributes its factory-block method',
|
||||
(owner, ownerLabel, method) => {
|
||||
(owner, ownerLabel, method, qualifiedOwner) => {
|
||||
const ownerNode = result.graph.nodes.find(
|
||||
(node) => node.label === ownerLabel && node.properties.name === owner,
|
||||
(node) =>
|
||||
node.label === ownerLabel &&
|
||||
node.properties.name === owner &&
|
||||
node.id.includes(qualifiedOwner),
|
||||
);
|
||||
const ownership = getRelationships(result, 'HAS_METHOD').filter(
|
||||
(edge) => edge.target === method,
|
||||
);
|
||||
|
||||
expect(ownerNode).toBeDefined();
|
||||
expect(ownership.map((edge) => edge.source)).toEqual([owner]);
|
||||
expect(ownership.map((edge) => edge.rel.sourceId)).toEqual([ownerNode?.id]);
|
||||
},
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue