diff --git a/web/ui/react-app/src/pages/targets/TargetLabels.test.tsx b/web/ui/react-app/src/pages/targets/TargetLabels.test.tsx index e71d311b9..1f7d56dc4 100644 --- a/web/ui/react-app/src/pages/targets/TargetLabels.test.tsx +++ b/web/ui/react-app/src/pages/targets/TargetLabels.test.tsx @@ -31,8 +31,10 @@ describe('targetLabels', () => { it('wraps each label in a label badge', () => { const l: { [key: string]: string } = defaultProps.labels; Object.keys(l).forEach((labelName: string): void => { - const badge = targetLabels.find(Badge).filterWhere(badge => badge.hasClass(labelName)); - expect(badge.children().text()).toEqual(`${labelName}="${l[labelName]}"`); + const badge = targetLabels + .find(Badge) + .filterWhere(badge => badge.children().text() === `${labelName}="${l[labelName]}"`); + expect(badge).toHaveLength(1); }); expect(targetLabels.find(Badge)).toHaveLength(3); }); diff --git a/web/ui/react-app/src/pages/targets/TargetLabels.tsx b/web/ui/react-app/src/pages/targets/TargetLabels.tsx index 45376a182..fdc7ae070 100644 --- a/web/ui/react-app/src/pages/targets/TargetLabels.tsx +++ b/web/ui/react-app/src/pages/targets/TargetLabels.tsx @@ -27,7 +27,7 @@ const TargetLabels: FC = ({ discoveredLabels, labels, idx, sc
{Object.keys(labels).map(labelName => { return ( - + {`${labelName}="${labels[labelName]}"`} ); diff --git a/web/ui/react-app/src/pages/targets/__snapshots__/TargetLabels.test.tsx.snap b/web/ui/react-app/src/pages/targets/__snapshots__/TargetLabels.test.tsx.snap index 7613249cb..76c139feb 100644 --- a/web/ui/react-app/src/pages/targets/__snapshots__/TargetLabels.test.tsx.snap +++ b/web/ui/react-app/src/pages/targets/__snapshots__/TargetLabels.test.tsx.snap @@ -7,7 +7,7 @@ exports[`targetLabels renders discovered labels 1`] = ` id="series-labels-cortex/node-exporter_group/0-1" >