diff --git a/packages/integration/src/azure/config.ts b/packages/integration/src/azure/config.ts index 2f6a08a43c..3d6244d69a 100644 --- a/packages/integration/src/azure/config.ts +++ b/packages/integration/src/azure/config.ts @@ -359,14 +359,14 @@ export function readAzureIntegrationConfigs( } /** - * These config sections have been removed but to insure they + * These config sections have been removed but to ensure they * don't leak sensitive tokens we have this check in place * to throw an error if found * * @internal * @deprecated To be removed at a later date */ -export function deprecatedConfigCheck(config: Config) { +function deprecatedConfigCheck(config: Config) { if (config.getOptional('credential') || config.getOptional('token')) { throw new Error( `Invalid Azure integration config, 'credential' and 'token' have been removed. Use 'credentials' instead.`, diff --git a/packages/integration/src/gerrit/core.test.ts b/packages/integration/src/gerrit/core.test.ts index 60bd898008..b22b5f2caf 100644 --- a/packages/integration/src/gerrit/core.test.ts +++ b/packages/integration/src/gerrit/core.test.ts @@ -311,6 +311,45 @@ describe('gerrit core', () => { 'https://gerrit.com/a/projects/web%2Fproject/branches/master', ); }); + it('throws when ref type is not a branch (tag).', () => { + const config: GerritIntegrationConfig = { + host: 'gerrit.com', + baseUrl: 'https://gerrit.com', + gitilesBaseUrl: 'https://gerrit.com', + }; + expect(() => + getGerritBranchApiUrl( + config, + 'https://gerrit.com/web/project/+/refs/tags/v1.0.0/README.md', + ), + ).toThrow('Unsupported gitiles ref type: tag'); + }); + it('throws when ref type is not a branch (sha).', () => { + const config: GerritIntegrationConfig = { + host: 'gerrit.com', + baseUrl: 'https://gerrit.com', + gitilesBaseUrl: 'https://gerrit.com', + }; + expect(() => + getGerritBranchApiUrl( + config, + 'https://gerrit.com/web/project/+/157f862803d45b9d269f0e390f88aece1ded51e8/README.md', + ), + ).toThrow('Unsupported gitiles ref type: sha'); + }); + it('throws when ref type is not a branch (head).', () => { + const config: GerritIntegrationConfig = { + host: 'gerrit.com', + baseUrl: 'https://gerrit.com', + gitilesBaseUrl: 'https://gerrit.com', + }; + expect(() => + getGerritBranchApiUrl( + config, + 'https://gerrit.com/web/project/+/HEAD/README.md', + ), + ).toThrow('Unsupported gitiles ref type: head'); + }); }); describe('getGerritCloneRepoUrl', () => {