fix tests

Signed-off-by: Kiss Miklos <miklos@roadie.io>
This commit is contained in:
Kiss Miklos
2022-09-29 19:42:11 +02:00
parent 2f5b97df6c
commit 3cbe42d8a9
2 changed files with 9 additions and 13 deletions
@@ -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',
@@ -20,7 +20,6 @@ export {
getOrganizationRepositories,
getOrganizationTeams,
getOrganizationUsers,
getRepository,
} from './github';
export { assignGroupsToUsers, buildOrgHierarchy } from './org';
export { parseGitHubOrgUrl } from './util';