-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Torsten Knauf
authored and
Torsten Knauf
committed
Mar 22, 2022
1 parent
010bddd
commit 7f78a73
Showing
2 changed files
with
32 additions
and
1 deletion.
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
31 changes: 31 additions & 0 deletions
31
...alization/app/codeCharta/ui/metricChooser/metricType/createAttributeType.selector.spec.ts
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,31 @@ | ||
import { AttributeTypeValue } from "../../../codeCharta.model" | ||
import { setAreaMetric } from "../../../state/store/dynamicSettings/areaMetric/areaMetric.actions" | ||
import { setEdgeMetric } from "../../../state/store/dynamicSettings/edgeMetric/edgeMetric.actions" | ||
import { setAttributeTypes } from "../../../state/store/fileSettings/attributeTypes/attributeTypes.actions" | ||
import { Store } from "../../../state/store/store" | ||
import { createAttributeTypeSelector } from "./createAttributeTypeSelector.selector" | ||
|
||
describe("createAttributeTypeSelector", () => { | ||
beforeEach(() => { | ||
Store["initialize"]() | ||
}) | ||
|
||
it("should default to 'Σ'", () => { | ||
const attributeTypeSelector = createAttributeTypeSelector("nodes", "areaMetric") | ||
expect(attributeTypeSelector(Store.store.getState())).toBe("Σ") | ||
}) | ||
|
||
it("should read nodes", () => { | ||
Store.store.dispatch(setAttributeTypes({ nodes: { rloc: AttributeTypeValue.relative } })) | ||
Store.store.dispatch(setAreaMetric("rloc")) | ||
const attributeTypeSelector = createAttributeTypeSelector("nodes", "areaMetric") | ||
expect(attributeTypeSelector(Store.store.getState())).toBe("x͂") | ||
}) | ||
|
||
it("should read edges", () => { | ||
Store.store.dispatch(setAttributeTypes({ edges: { avgCommit: AttributeTypeValue.relative } })) | ||
Store.store.dispatch(setEdgeMetric("avgCommit")) | ||
const attributeTypeSelector = createAttributeTypeSelector("edges", "edgeMetric") | ||
expect(attributeTypeSelector(Store.store.getState())).toBe("x͂") | ||
}) | ||
}) |