integration support for harness p5-fixed lint

Signed-off-by: Calvin Lee <cjlee@ualberta.ca>
This commit is contained in:
Calvin Lee
2024-04-23 21:13:04 -06:00
parent 0cf356671a
commit 1cfa4aa35e
5 changed files with 7 additions and 20 deletions
+1 -2
View File
@@ -551,8 +551,7 @@ export class HarnessUrlReader implements UrlReader {
// @public
export type HarnessIntegrationConfig = {
host: string;
baseUrl?: string;
username?: string;
apiKey?: string;
token?: string;
};
@@ -69,19 +69,19 @@ const harnessApiResponse = (content: any) => {
const handlers = [
rest.get(
'https://app.harness.io/gateway/code/api/v1/repos/accountId/orgName/projName/repoName/:path+/content/all-apis.yaml',
(req, res, ctx) => {
(_req, res, ctx) => {
return res(ctx.status(500), ctx.json({ message: 'Error!!!' }));
},
),
rest.get(
'https://app.harness.io/gateway/code/api/v1/repos/accountId/orgName/projName/repoName/:path+/content/404error.yaml',
(req, res, ctx) => {
(_req, res, ctx) => {
return res(ctx.status(404), ctx.json({ message: 'File not found.' }));
},
),
rest.get(
'https://app.harness.io/gateway/code/api/v1/repos/accountId/orgName/projName/repoName/:path+/content/stream.TXT',
(req, res, ctx) => {
(_req, res, ctx) => {
return res(
ctx.status(200),
ctx.body(harnessApiResponse(responseBuffer.toString())),
@@ -91,7 +91,7 @@ const handlers = [
rest.get(
'https://app.harness.io/gateway/code/api/v1/repos/accountId/orgName/projName/repoName/:path+/content/buffer.TXT',
(req, res, ctx) => {
(_req, res, ctx) => {
return res(
ctx.status(200),
ctx.body(harnessApiResponse(responseBuffer.toString())),
+2 -8
View File
@@ -353,16 +353,10 @@ export interface Config {
*/
host: string;
/**
* The base url for the Gitea instance.
* @visibility frontend
*/
baseUrl?: string;
/**
* The username to use for authenticated requests.
* The apikey to use for authenticated requests.
* @visibility secret
*/
username?: string;
apiKey?: string;
/**
* Harness Code token used to authenticate requests. This can be either a generated access token.
* @visibility secret
@@ -81,9 +81,6 @@ describe('readHarnessConfig', () => {
expect(() => readHarnessConfig(buildConfig({ ...valid, host: 2 }))).toThrow(
/host/,
);
expect(() =>
readHarnessConfig(buildConfig({ ...valid, baseUrl: 2 })),
).toThrow(/baseUrl/);
});
it('works on the frontend', async () => {
@@ -44,7 +44,6 @@ export type HarnessIntegrationConfig = {
*/
export function readHarnessConfig(config: Config): HarnessIntegrationConfig {
const host = config.getString('host');
let baseUrl = config.getOptionalString('baseUrl');
const token = config.getOptionalString('token');
const apiKey = config.getOptionalString('apiKey');
@@ -54,8 +53,6 @@ export function readHarnessConfig(config: Config): HarnessIntegrationConfig {
);
}
baseUrl = `https://${host}`;
return {
host,
apiKey,