All files / app/codeCharta/state/selectors/accumulatedData/metricData selectedColorMetricData.selector.ts

100% Statements 7/7
100% Branches 24/24
100% Functions 2/2
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1862x 62x 62x             62x 26x 26x            
import { createSelector } from "@ngrx/store"
import { colorMetricSelector } from "../../../store/dynamicSettings/colorMetric/colorMetric.selector"
import { metricDataSelector } from "./metricData.selector"
 
export type MetricMinMax = {
    minValue: number
    maxValue: number
}
 
export const selectedColorMetricDataSelector = createSelector(metricDataSelector, colorMetricSelector, (metricData, colorMetric) => {
    const data = metricData.nodeMetricData.find(x => x.name === colorMetric)
    return {
        values: data?.values ?? [],
        minValue: data?.minValue ?? 0,
        maxValue: data?.maxValue ?? 0
    }
})