get rid of circular imports
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -20,7 +20,7 @@ import {
|
||||
GerritIntegrationConfig,
|
||||
readGerritIntegrationConfigs,
|
||||
} from './config';
|
||||
import { parseGerritGitilesUrl, builldGerritGitilesUrl } from './core';
|
||||
import { parseGerritGitilesUrl, buildGerritGitilesUrl } from './core';
|
||||
|
||||
/**
|
||||
* A Gerrit based integration.
|
||||
@@ -61,7 +61,7 @@ export class GerritIntegration implements ScmIntegration {
|
||||
let updated;
|
||||
if (url.startsWith('/')) {
|
||||
const { branch, project } = parseGerritGitilesUrl(this.config, base);
|
||||
return builldGerritGitilesUrl(this.config, project, branch, url);
|
||||
return buildGerritGitilesUrl(this.config, project, branch, url);
|
||||
}
|
||||
if (url) {
|
||||
updated = new URL(url, base);
|
||||
|
||||
@@ -20,7 +20,7 @@ import fetch from 'cross-fetch';
|
||||
import { setupRequestMockHandlers } from '@backstage/test-utils';
|
||||
import { GerritIntegrationConfig } from './config';
|
||||
import {
|
||||
builldGerritGitilesUrl,
|
||||
buildGerritGitilesUrl,
|
||||
getGerritBranchApiUrl,
|
||||
getGerritCloneRepoUrl,
|
||||
getGerritRequestOptions,
|
||||
@@ -33,14 +33,14 @@ describe('gerrit core', () => {
|
||||
const worker = setupServer();
|
||||
setupRequestMockHandlers(worker);
|
||||
|
||||
describe('builldGerritGitilesUrl', () => {
|
||||
describe('buildGerritGitilesUrl', () => {
|
||||
it('can create an url from arguments', () => {
|
||||
const config: GerritIntegrationConfig = {
|
||||
host: 'gerrit.com',
|
||||
gitilesBaseUrl: 'https://gerrit.com/gitiles',
|
||||
};
|
||||
expect(
|
||||
builldGerritGitilesUrl(config, 'repo', 'dev', 'catalog-info.yaml'),
|
||||
buildGerritGitilesUrl(config, 'repo', 'dev', 'catalog-info.yaml'),
|
||||
).toEqual(
|
||||
'https://gerrit.com/gitiles/repo/+/refs/heads/dev/catalog-info.yaml',
|
||||
);
|
||||
|
||||
@@ -13,8 +13,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { trimStart } from 'lodash';
|
||||
import { GerritIntegrationConfig } from '.';
|
||||
import { GerritIntegrationConfig } from './config';
|
||||
|
||||
const GERRIT_BODY_PREFIX = ")]}'";
|
||||
|
||||
@@ -79,7 +80,7 @@ export function parseGerritGitilesUrl(
|
||||
* @param filePath - The absolute file path.
|
||||
* @public
|
||||
*/
|
||||
export function builldGerritGitilesUrl(
|
||||
export function buildGerritGitilesUrl(
|
||||
config: GerritIntegrationConfig,
|
||||
project: string,
|
||||
branch: string,
|
||||
|
||||
Reference in New Issue
Block a user