From cfc6e19cb6945da9de2e0220a972d1a10a6b6e7f Mon Sep 17 00:00:00 2001 From: tzerr Date: Wed, 23 Aug 2023 12:47:32 +0200 Subject: [PATCH] -changed: ignoring hg and svn repos in get All Repos function -fixed: failing test --- lib/modules/platform/scmm/index.spec.ts | 2 ++ lib/modules/platform/scmm/index.ts | 2 +- lib/modules/platform/scmm/scm-client.spec.ts | 13 +++++++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/modules/platform/scmm/index.spec.ts b/lib/modules/platform/scmm/index.spec.ts index 579e484332d259..af2774d5a91188 100644 --- a/lib/modules/platform/scmm/index.spec.ts +++ b/lib/modules/platform/scmm/index.spec.ts @@ -153,6 +153,8 @@ describe('modules/platform/scmm/index', () => { .mockResolvedValueOnce([ repo, { ...repo, namespace: 'other', name: 'repository' }, + { ...repo, namespace: 'other', name: 'mercurial', type: 'hg'}, + { ...repo, namespace: 'other', name: 'subversion', type: 'svn'} ]); expect(await getRepos()).toEqual(['default/repo', 'other/repository']); diff --git a/lib/modules/platform/scmm/index.ts b/lib/modules/platform/scmm/index.ts index 367272988eee88..d27b8766ea0286 100644 --- a/lib/modules/platform/scmm/index.ts +++ b/lib/modules/platform/scmm/index.ts @@ -96,7 +96,7 @@ export async function initRepo({ } export async function getRepos(): Promise { - const repos = await scmmClient.getAllRepos(); + const repos = (await scmmClient.getAllRepos()).filter(repo => repo.type === 'git'); const result = repos.map((repo) => `${repo.namespace}/${repo.name}`); logger.info(`Discovered ${repos.length} repos`); diff --git a/lib/modules/platform/scmm/scm-client.spec.ts b/lib/modules/platform/scmm/scm-client.spec.ts index 35522aaa5b131f..df79be1d1b4880 100644 --- a/lib/modules/platform/scmm/scm-client.spec.ts +++ b/lib/modules/platform/scmm/scm-client.spec.ts @@ -299,13 +299,22 @@ describe('modules/platform/scmm/scm-client', () => { .put(`/pull-requests/${repo.namespace}/${repo.name}/${expectedPrId}`) .reply(204); - expect( + /*expect( await scmClient.updatePr( `${repo.namespace}/${repo.name}`, expectedPrId, expectedUpdateParams ) - ).not.toThrow(); + ).not.toThrow();*/ + await expect( + scmClient.updatePr( + `${repo.namespace}/${repo.name}`, + expectedPrId, + expectedUpdateParams + ) + ).resolves.not.toThrowError(); + + }); it.each([[400], [401], [403], [404], [500]])(