fix(trading): show full node URI in trading footer (#3978)

This commit is contained in:
m.ray 2023-05-26 19:38:02 +03:00 committed by GitHub
parent cd6d350047
commit 0f2b86770a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -36,11 +36,12 @@ describe('NodeHealth', () => {
describe('NodeUrl', () => {
it('renders correct part of node url', () => {
const node = 'https://api.n99.somenetwork.vega.xyz';
const expectedText = node.split('.').slice(1).join('.');
render(<NodeUrl url={node} />);
expect(screen.getByText(expectedText)).toBeInTheDocument();
expect(
screen.getByText('api.n99.somenetwork.vega.xyz')
).toBeInTheDocument();
});
});

View File

@ -65,9 +65,8 @@ interface NodeUrlProps {
}
export const NodeUrl = ({ url }: NodeUrlProps) => {
// get base url from api url, api sub domain
const urlObj = new URL(url);
const nodeUrl = urlObj.origin.replace(/^[^.]+\./g, '');
const nodeUrl = urlObj.hostname;
return <span title={t('Connected node')}>{nodeUrl}</span>;
};