-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #832 from visualize-admin/fix/unique-values-hierar…
…chies
- Loading branch information
Showing
3 changed files
with
6,435 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import hierarchy from "../../test/__fixtures/data/tarrifs-hierarchy.json"; | ||
|
||
import { groupByParents } from "./use-hierarchy-parents"; | ||
|
||
describe("grouping hierarchy by parents", () => { | ||
it("should work", () => { | ||
const archy = hierarchy as Parameters<typeof groupByParents>[0]; | ||
const groups = groupByParents(archy); | ||
const iri = | ||
"https://ld.admin.ch/cube/dimension/aussenhandel_warenkoerbe/1_listZT"; | ||
const ztGroups = groups.filter( | ||
([parents]) => | ||
parents.length > 0 && parents[parents.length - 1].value === iri | ||
)!; | ||
|
||
expect(ztGroups.length).toBe(1); | ||
const ztGroup = ztGroups[0]!; | ||
const [parents, children] = ztGroup; | ||
expect(parents.length).toBe(2); | ||
expect(children.length).toBe(41); | ||
}); | ||
}); |
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
Oops, something went wrong.
7d86022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
visualization-tool – ./
visualization-tool-alpha.vercel.app
visualization-tool-git-main-ixt1.vercel.app
visualization-tool-ixt1.vercel.app