-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(lineage) Filter dataset -> dataset lineage edges if data is trans…
…formed
- Loading branch information
Chris Collins
authored and
Chris Collins
committed
Apr 27, 2022
1 parent
40cb83f
commit 15f200d
Showing
5 changed files
with
224 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
datahub-web-react/src/app/lineage/__tests__/constructFetchedNode.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { dataset1, dataset2, dataJob1, dataset1FetchedEntity, dataset2FetchedEntity } from '../../../Mocks'; | ||
import { EntityType } from '../../../types.generated'; | ||
import { Direction, EntityAndType, FetchedEntity } from '../types'; | ||
import { shouldIncludeChildEntity } from '../utils/constructFetchedNode'; | ||
|
||
describe('shouldIncludeChildEntity', () => { | ||
const parentChildren = [ | ||
{ entity: dataset1, type: dataset1.type }, | ||
{ entity: dataJob1, type: dataJob1.type }, | ||
] as EntityAndType[]; | ||
|
||
it('should return false if parent and child are datasets and the child has a datajob child that belongs to the parent children', () => { | ||
const shouldBeIncluded = shouldIncludeChildEntity( | ||
Direction.Upstream, | ||
parentChildren, | ||
dataset1FetchedEntity, | ||
dataset2FetchedEntity, | ||
); | ||
|
||
expect(shouldBeIncluded).toBe(false); | ||
}); | ||
|
||
it('should return true if the datajob is not a child of the parent', () => { | ||
const parentChild = [{ entity: dataset1, type: dataset1.type }] as EntityAndType[]; | ||
const shouldBeIncluded = shouldIncludeChildEntity( | ||
Direction.Upstream, | ||
parentChild, | ||
dataset1FetchedEntity, | ||
dataset2FetchedEntity, | ||
); | ||
|
||
expect(shouldBeIncluded).toBe(true); | ||
}); | ||
|
||
it('should return true if either parent or child is not a dataset', () => { | ||
const fetchedDatajobEntity = { ...dataset1FetchedEntity, type: EntityType.DataJob }; | ||
let shouldBeIncluded = shouldIncludeChildEntity( | ||
Direction.Upstream, | ||
parentChildren, | ||
fetchedDatajobEntity, | ||
dataset2FetchedEntity, | ||
); | ||
expect(shouldBeIncluded).toBe(true); | ||
|
||
const fetchedDashboardEntity = { ...dataset2FetchedEntity, type: EntityType.Dashboard }; | ||
shouldBeIncluded = shouldIncludeChildEntity( | ||
Direction.Upstream, | ||
parentChildren, | ||
dataset1FetchedEntity, | ||
fetchedDashboardEntity, | ||
); | ||
expect(shouldBeIncluded).toBe(true); | ||
}); | ||
|
||
it('should return true if the parent has a datajob child that is not a child of the dataset child', () => { | ||
const updatedDataset1FetchedEntity = { | ||
...dataset1FetchedEntity, | ||
downstreamChildren: [{ type: EntityType.Dataset, entity: dataset2 }], | ||
} as FetchedEntity; | ||
|
||
const shouldBeIncluded = shouldIncludeChildEntity( | ||
Direction.Upstream, | ||
parentChildren, | ||
updatedDataset1FetchedEntity, | ||
dataset2FetchedEntity, | ||
); | ||
|
||
expect(shouldBeIncluded).toBe(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters