Add test to valid the baseURL

Signed-off-by: cmoulliard <cmoulliard@redhat.com>
This commit is contained in:
cmoulliard
2023-12-20 10:52:28 +01:00
parent 07bd2fbeb4
commit 51fec95f33
+5 -1
View File
@@ -16,7 +16,7 @@
import { Config } from '@backstage/config';
import { trimEnd } from 'lodash';
import { isValidHost } from '../helpers';
import { isValidHost, isValidUrl } from '../helpers';
/**
* The configuration for a single Gitea integration.
@@ -62,6 +62,10 @@ export function readGiteaConfig(config: Config): GiteaIntegrationConfig {
throw new Error(
`Invalid Gitea integration config, '${host}' is not a valid host`,
);
} else if (baseUrl && !isValidUrl(baseUrl)) {
throw new Error(
`Invalid Gitea integration config, '${baseUrl}' is not a valid baseUrl`,
);
}
if (baseUrl) {