Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -221,5 +221,41 @@ describe('executeStepWithDependencies', () => {

expect(stepTwoExecutionHandlerDidExecute).toBe(true);
});

test('should work with normalizeGraphObjectKey', async () => {
const e1 = getMockEntity();
const e2 = getMockEntity();
e2._key = 'KeY2';
const r1 = createDirectRelationship({
from: e1,
_class: RelationshipClass.HAS,
to: e2,
});

const stepOne = getMockIntegrationStep({
id: 'step-1',
executionHandler: async ({ jobState }) => {
await jobState.addEntity(e1);
await jobState.addEntity(e2);
if (jobState.hasKey('key2')) {
await jobState.addRelationship(r1);
}
},
});

await expect(
executeStepWithDependencies({
stepId: stepOne.id,
invocationConfig: getMockInvocationConfig({
integrationSteps: [stepOne],
normalizeGraphObjectKey: (_key) => _key.toLowerCase(),
}),
instanceConfig: getMockInstanceConfig(),
}),
).resolves.toMatchObject({
collectedEntities: [e1, e2],
collectedRelationships: [r1],
});
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export async function executeStepWithDependencies(params: StepTestConfig) {
entities: preContext.jobState.collectedEntities,
relationships: preContext.jobState.collectedRelationships,
setData: preContext.jobState.collectedData,
normalizeGraphObjectKey: invocationConfig.normalizeGraphObjectKey,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only change, only affects executeStepsWithDependencies

}),
executionConfig,
};
Expand Down