diff --git a/web/ui/react-app/src/pages/targets/EndpointLink.test.tsx b/web/ui/react-app/src/pages/targets/EndpointLink.test.tsx index d89326f73..6b29d43c2 100644 --- a/web/ui/react-app/src/pages/targets/EndpointLink.test.tsx +++ b/web/ui/react-app/src/pages/targets/EndpointLink.test.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { shallow } from 'enzyme'; +import { shallow, mount } from 'enzyme'; import { Badge, Alert } from 'reactstrap'; import EndpointLink from './EndpointLink'; @@ -35,4 +35,14 @@ describe('EndpointLink', () => { const err = endpointLink.find(Alert); expect(err.render().text()).toEqual('Error: Invalid URL'); }); + + it('handles params with multiple values correctly', () => { + const consoleSpy = jest.spyOn(console, "warn"); + const endpoint = `http://example.com/federate?match[]={__name__="name1"}&match[]={__name__="name2"}&match[]={__name__="name3"}`; + const globalURL = 'http://example.com/federate'; + const endpointLink = mount(); + const badges = endpointLink.find(Badge); + expect(badges).toHaveLength(3); + expect(consoleSpy).not.toHaveBeenCalled(); + }); }); diff --git a/web/ui/react-app/src/pages/targets/EndpointLink.tsx b/web/ui/react-app/src/pages/targets/EndpointLink.tsx index 3f524658b..a86a93429 100644 --- a/web/ui/react-app/src/pages/targets/EndpointLink.tsx +++ b/web/ui/react-app/src/pages/targets/EndpointLink.tsx @@ -27,7 +27,7 @@ const EndpointLink: FC = ({ endpoint, globalUrl }) => { {params.length > 0 ?
: null} {params.map(([labelName, labelValue]: [string, string]) => { return ( - + {`${labelName}="${labelValue}"`} );