From 3cbe42d8a97a331444286c6b05b77cad4642ebe7 Mon Sep 17 00:00:00 2001 From: Kiss Miklos Date: Thu, 29 Sep 2022 19:42:11 +0200 Subject: [PATCH] fix tests Signed-off-by: Kiss Miklos --- .../analyzers/GitHubLocationAnalyzer.test.ts | 21 ++++++++----------- .../src/lib/index.ts | 1 - 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/plugins/catalog-backend-module-github/src/analyzers/GitHubLocationAnalyzer.test.ts b/plugins/catalog-backend-module-github/src/analyzers/GitHubLocationAnalyzer.test.ts index 5ceb9cf85c..f4996f232a 100644 --- a/plugins/catalog-backend-module-github/src/analyzers/GitHubLocationAnalyzer.test.ts +++ b/plugins/catalog-backend-module-github/src/analyzers/GitHubLocationAnalyzer.test.ts @@ -37,7 +37,7 @@ import { GitHubLocationAnalyzer } from './GitHubLocationAnalyzer'; import { setupRequestMockHandlers } from '@backstage/backend-test-utils'; import { setupServer } from 'msw/node'; import { rest } from 'msw'; -import { GitHubIntegration } from '@backstage/integration'; +import { ConfigReader } from '@backstage/config'; const server = setupServer(); @@ -46,17 +46,14 @@ describe('GitHubLocationAnalyzer', () => { getBaseUrl: jest.fn().mockResolvedValue('http://localhost:7007'), getExternalBaseUrl: jest.fn(), }; - const integrations = { - list: jest.fn(), - byHost: jest.fn(), - byUrl: () => - new GitHubIntegration({ + const config = new ConfigReader({ + integrations: { + github: { host: 'h.com', - apiBaseUrl: 'a', - rawBaseUrl: 'r', token: 't', - }), - }; + }, + }, + }); setupRequestMockHandlers(server); @@ -117,7 +114,7 @@ describe('GitHubLocationAnalyzer', () => { const analyzer = new GitHubLocationAnalyzer({ discovery: mockDiscoveryApi, - integrations, + config, }); const result = await analyzer.analyze({ url: 'https://github.com/foo/bar', @@ -142,7 +139,7 @@ describe('GitHubLocationAnalyzer', () => { const analyzer = new GitHubLocationAnalyzer({ discovery: mockDiscoveryApi, - integrations, + config, }); const result = await analyzer.analyze({ url: 'https://github.com/foo/bar', diff --git a/plugins/catalog-backend-module-github/src/lib/index.ts b/plugins/catalog-backend-module-github/src/lib/index.ts index 28cbe898d6..26ec3e8516 100644 --- a/plugins/catalog-backend-module-github/src/lib/index.ts +++ b/plugins/catalog-backend-module-github/src/lib/index.ts @@ -20,7 +20,6 @@ export { getOrganizationRepositories, getOrganizationTeams, getOrganizationUsers, - getRepository, } from './github'; export { assignGroupsToUsers, buildOrgHierarchy } from './org'; export { parseGitHubOrgUrl } from './util';