Skip to content

Commit

Permalink
Fix formatting with Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
rm3l committed Jun 21, 2024
1 parent 793b0a9 commit a27a302
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -914,9 +914,9 @@ describe('CustomGithubCredentialsProvider tests', () => {
{
type: 'app',
headers: {
Authorization: "Bearer secret_token"
Authorization: 'Bearer secret_token',
},
token: "secret_token",
token: 'secret_token',
appId: 3,
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,44 +94,44 @@ describe('catalogInfoGenerator', () => {
);
});

it('should return catalog-info yaml string if analyze-location endpoint returns some data', async () => {
(fetch as unknown as jest.Mock).mockReturnValue(
Promise.resolve({
json: () =>
Promise.resolve(
mockAnalyzeLocationResponse('my-org-4', [
'my-repo-comp-41',
'my-repo-comp-42',
]),
),
}),
);
it('should return catalog-info yaml string if analyze-location endpoint returns some data', async () => {
(fetch as unknown as jest.Mock).mockReturnValue(
Promise.resolve({
json: () =>
Promise.resolve(
mockAnalyzeLocationResponse('my-org-4', [
'my-repo-comp-41',
'my-repo-comp-42',
]),
),
}),
);

const repoUrl = 'https://github.com/my-org-4/my-repo-4';
await expect(
catalogInfoGenerator.generateDefaultCatalogInfoContent(repoUrl),
).resolves.toBe(`---
const repoUrl = 'https://github.com/my-org-4/my-repo-4';
await expect(
catalogInfoGenerator.generateDefaultCatalogInfoContent(repoUrl),
).resolves.toBe(`---
${getDefaultCatalogInfoWithoutSeparators('my-org-4', 'my-repo-comp-41')}
---
${getDefaultCatalogInfoWithoutSeparators('my-org-4', 'my-repo-comp-42')}
`);
expect(fetch).toHaveBeenCalledWith(
`${mockBaseUrl}/my-catalog/analyze-location`,
{
headers: {
'Content-Type': 'application/json',
},
method: 'POST',
body: JSON.stringify({
location: {
type: 'github',
target: repoUrl,
},
}),
expect(fetch).toHaveBeenCalledWith(
`${mockBaseUrl}/my-catalog/analyze-location`,
{
headers: {
'Content-Type': 'application/json',
},
);
});
method: 'POST',
body: JSON.stringify({
location: {
type: 'github',
target: repoUrl,
},
}),
},
);
});
});

function getDefaultCatalogInfo(org: string, name: string): string {
Expand Down
11 changes: 7 additions & 4 deletions plugins/bulk-import-backend/src/service/githubApiService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { CustomGithubCredentialsProvider } from '../helpers';
import { GithubApiService } from './githubApiService';

const octokit = {
paginate: async (fn: any) => {
paginate: async (fn: any) => {
const res = await fn();
if (res) {
return res.data;
Expand Down Expand Up @@ -383,8 +383,8 @@ describe('GithubApiService tests', () => {
errors: [
{
error: {
message: "This is taking quite a while",
name: "504 Gateway Timeout",
message: 'This is taking quite a while',
name: '504 Gateway Timeout',
},
type: 'token',
},
Expand Down Expand Up @@ -455,7 +455,10 @@ describe('GithubApiService tests', () => {
});

it('does not throw an error if no integration in config because there is one added automatically', async () => {
const repos = await new GithubApiService(logger, new ConfigReader({})).getRepositoriesFromIntegrations();
const repos = await new GithubApiService(
logger,
new ConfigReader({}),
).getRepositoriesFromIntegrations();
expect(repos).toEqual({
errors: [],
repositories: [],
Expand Down
4 changes: 3 additions & 1 deletion plugins/bulk-import-backend/src/service/githubApiService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ export class GithubApiService {
this.logger.debug(
'No GitHub Integration in config => returning an empty list of repositories.',
);
throw new Error("Looks like there is no GitHub Integration in config. Please add a configuration entry under 'integrations.github");
throw new Error(
"Looks like there is no GitHub Integration in config. Please add a configuration entry under 'integrations.github",
);
}

const credentialsByConfig = new Map<
Expand Down

0 comments on commit a27a302

Please sign in to comment.