Skip to content

Commit

Permalink
chore: remove todos
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryAnansky authored and RomanHotsiy committed Feb 18, 2025
1 parent 70f6ed3 commit d146a22
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
// expect(result).toMatchSnapshot();
// });


test('local-json-server test case', () => {
//TODO: Remove.Disable this test until json-server is added to the e2e flow.
expect(true).toBe(true);
Expand Down
2 changes: 1 addition & 1 deletion packages/respect-core/src/handlers/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export async function handleRun(argv: any) {
logger.printNewLine();

if (testsRunProblemsStatus.some((problems) => problems)) {
exitWithErrorMsg(' Tests exited with error ', 1); // todo check this
exitWithErrorMsg(' Tests exited with error ', 1);
}
} catch (err) {
exitWithErrorMsg((err as Error)?.message ?? err, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ const getRequestBodyMultipartFormData = async (
payload: RequestBody['payload'],
formData: FormData
) => {
// TODO: handle other than object payload type
if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
const promises: Promise<void>[] = [];
appendObjectToFormData(promises, formData, payload);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function getOperationById(
} else {
if (operationDetails.operationId === operationId) {
return {
servers: (pathDetails as any).servers || rootServers, // TODO: fix typings
servers: (pathDetails as any).servers || rootServers,
...operationDetails,
pathParameters: operationDetails.parameters || [],
path,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,26 @@ import { evaluateRuntimeExpressionPayload } from '../runtime-expressions';

import type { RequestData } from './prepare-request';
import type { TestContext, Step } from '../../types';
import type { OperationDetails } from '../description-parser';
import type { ParameterWithIn } from '../config-parser';

// TODO: rename
export type ResultObject = {
ctx: TestContext;
workflowName: string;
step: Step;
requestData: {
serverUrl?: {
url: string;
// TODO: support variables
};
path: string;
method: string;
parameters: ParameterWithIn[];
requestBody: any;
openapiOperation?: OperationDetails & Record<string, string>;
};
};

// TODO: split into two functions
export async function callAPIAndAnalyzeResults({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export async function createTestContext(
const ctx: TestContext = {
$response: undefined,
$request: undefined,
$inputs: { env: {} }, // todo: check me?
$inputs: { env: {} },
$faker: faker,
$sourceDescriptions: bundledDescriptions,
$workflows: getPublicWorkflows({
Expand Down
2 changes: 0 additions & 2 deletions packages/respect-core/src/modules/flow-runner/runner.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//@ts-ignore
import { blue, green } from 'colorette';
import { basename, dirname, resolve } from 'node:path';
import { writeFileSync } from 'node:fs';
Expand Down Expand Up @@ -143,7 +142,6 @@ export async function runWorkflow({

const workflowName = workflow?.workflowId || parentWorkflowId;

// TODO: pass logger
if (parentWorkflowId && parentStepId) {
printStepWorkflowSeparator(parentStepId, parentWorkflowId);
} else if (parentWorkflowId) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import Ajv, { type JSONSchemaType } from '@redocly/ajv/dist/2020';
import { diffLinesUnified } from 'jest-diff';
import { blue, dim, red, yellow } from 'colorette';

import type { Check, DescriptionChecks, StepCallContext, TestContext } from '../../../types';

import { type Check, type DescriptionChecks, type StepCallContext, type TestContext } from '../../../types';
import { CHECKS } from '../../checks';
import { printErrors as printAjvErrors } from '../../../utils/ajv-errors';
import { checkCircularRefsInSchema } from '../../../utils/check-circular-refs-in-schema';
Expand All @@ -21,7 +19,7 @@ const ajvStrict = new Ajv({
validateSchema: false,
discriminator: true,
allowUnionTypes: true,
validateFormats: false, // TODO: fix it
validateFormats: false,
logger: false,
verbose: true,
defaultUnevaluatedProperties: false,
Expand Down Expand Up @@ -123,7 +121,6 @@ function checkStatusCodeFromDescription({
const message = matchesCodeFromDescription
? dim(`List of valid response codes are inferred from description \n\n`) +
diffLinesUnified(
// [`Expected one code from those: ${responseCodesFromDescription.join(', ')}`], // TODO: decide on output style
responseCodesFromDescription.map(String),
[`${responseStatusCode}`]
)
Expand Down
7 changes: 3 additions & 4 deletions packages/respect-core/src/utils/cli-outputs.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { pluralize } from 'jest-matcher-utils';
import { red, yellow, bold, blue } from 'colorette';

import type { Totals } from '@redocly/openapi-core';
import type { Check, VerboseLog } from '../types';

import { type Totals } from '@redocly/openapi-core';
import { type Check, type VerboseLog } from '../types';
import { displayChecks } from '../modules/cli-output';
import { DefaultLogger } from './logger/logger';

const logger = DefaultLogger.getInstance();

export const RESET_ESCAPE_CODE = '\x1B[0m';

export function removeExtraIndentation(message: string | undefined): string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ function handleNodeRequest(request: Request, handler: any, harLog?: Map<string,
method: request.method || 'GET',
url: request.url,
httpVersion: 'HTTP/1.1',
cookies: [], // TODO: Parse cookies from headers
cookies: [],
headers: formatUndiciHeaders(request.headers as any),
queryString: [], // TODO: Parse query params
queryString: [],
headersSize: -1,
bodySize: -1,
},
Expand Down
2 changes: 0 additions & 2 deletions packages/respect-core/src/utils/yaml.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// TODO: add a type for "types" https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/js-yaml/index.d.ts
// @ts-ignore

import { JSON_SCHEMA, types, load, dump } from 'js-yaml';
import { readFileSync } from 'fs';

Expand Down

0 comments on commit d146a22

Please sign in to comment.