Update project with latest eslint rules

This commit is contained in:
Debajyoti Halder
2021-01-29 11:55:12 +05:30
parent da661f836e
commit 6106345e6d
49 changed files with 173 additions and 157 deletions
@@ -43,10 +43,10 @@ describe('ScmIntegrations', () => {
} as GitLabIntegrationConfig);
const i = new ScmIntegrations({
azure: basicIntegrations([azure], i => i.config.host),
bitbucket: basicIntegrations([bitbucket], i => i.config.host),
github: basicIntegrations([github], i => i.config.host),
gitlab: basicIntegrations([gitlab], i => i.config.host),
azure: basicIntegrations([azure], item => item.config.host),
bitbucket: basicIntegrations([bitbucket], item => item.config.host),
github: basicIntegrations([github], item => item.config.host),
gitlab: basicIntegrations([gitlab], item => item.config.host),
});
it('can get the specifics', () => {
@@ -215,21 +215,21 @@ describe('GithubCredentialsProvider tests', () => {
});
it('should return the default token if no app is configured', async () => {
const github = GithubCredentialsProvider.create({
const githubID = GithubCredentialsProvider.create({
host: 'github.com',
apps: [],
token: 'fallback_token',
});
await expect(
github.getCredentials({
githubID.getCredentials({
url: 'https://github.com/404/foobar',
}),
).resolves.toEqual(expect.objectContaining({ token: 'fallback_token' }));
});
it('should return the configured token if listing installations throws', async () => {
const github = GithubCredentialsProvider.create({
const githubID = GithubCredentialsProvider.create({
host: 'github.com',
apps: [
{
@@ -245,19 +245,19 @@ describe('GithubCredentialsProvider tests', () => {
octokit.apps.listInstallations.mockRejectedValue({ status: 304 });
await expect(
github.getCredentials({
githubID.getCredentials({
url: 'https://github.com/backstage',
}),
).resolves.toEqual(expect.objectContaining({ token: 'hardcoded_token' }));
});
it('should return undefined if no token or apps are configured', async () => {
const github = GithubCredentialsProvider.create({
const githubID = GithubCredentialsProvider.create({
host: 'github.com',
});
await expect(
github.getCredentials({
githubID.getCredentials({
url: 'https://github.com/backstage',
}),
).resolves.toEqual({ headers: undefined, token: undefined });
@@ -177,7 +177,7 @@ export class GithubAppCredentialsMux {
),
);
const result = results.find(result => result.credentials);
const result = results.find(resultItem => resultItem.credentials);
if (result) {
return result.credentials!.accessToken;
}