Type References for Filter functions

This page provides detailed descriptions of the various TypeScript types used in the HyperTest CLI's filtering functions:

filterFunctionToIgnoreMockDiffs andfilterFunctionToIgnoreResponseDiffs

to help users identify and ignore known non-critical differences in mocks and responses.


MockDifferenceType

Defines the types of differences that can be identified between the recorded and replayed mocks:

enum MockDifferenceType {
  MOCK_NOT_USED,
  MOCK_NOT_FOUND,
  MOCK_FORCE_MATCHED,
  
  // Instrumentation mock diff types
  INSTRUMENTATION_MOCK_INPUT_KEY_REMOVED,
  INSTRUMENTATION_MOCK_INPUT_KEY_ADDED,
  INSTRUMENTATION_MOCK_INPUT_VALUE_MODIFIED,
  INSTRUMENTATION_MOCK_INPUT_DATA_TYPE_CHANGED,
  INSTRUMENTATION_MOCK_INPUT_LIST_ORDER_CHANGED,
  INSTRUMENTATION_MOCK_INPUT_LIST_ORDER_CHANGED_KEY_REMOVED,
  INSTRUMENTATION_MOCK_INPUT_LIST_ORDER_CHANGED_KEY_ADDED,
  INSTRUMENTATION_MOCK_INPUT_LIST_ORDER_CHANGED_VALUE_MODIFIED,
  INSTRUMENTATION_MOCK_INPUT_LIST_ORDER_DATA_TYPE_CHANGED,
  INSTRUMENTATION_MOCK_INPUT_LIST_ITEMS_ADDED,
  INSTRUMENTATION_MOCK_INPUT_LIST_ITEMS_REMOVED,
  INSTRUMENTATION_MOCK_INPUT_LIST_ITEMS_MODIFIED,
  INSTRUMENTATION_MOCK_INPUT_KEY_MODIFIED,
  INSTRUMENTATION_MOCK_INPUT_VALUE_REMOVED,
  INSTRUMENTATION_MOCK_INPUT_VALUE_ADDED,
  INSTRUMENTATION_MOCK_INPUT_DATA_TYPE_MODIFIED,
}

DifferenceType

Defines the types of differences identified between the expected and actual responses:

enum DifferenceType {
  OUTPUT_STATUS_CHANGED,
  CONTENT_TYPE_CHANGED,
  STATUS_CODE_CHANGED,
  HEADER_REMOVED,
  HEADER_ADDED,
  HEADER_MODIFIED,
  KEY_REMOVED,
  KEY_ADDED,
  VALUE_MODIFIED,
  DATA_TYPE_CHANGED,
  LIST_ORDER_CHANGED,
  LIST_ORDER_CHANGED_KEY_REMOVED,
  LIST_ORDER_CHANGED_KEY_ADDED,
  LIST_ORDER_CHANGED_VALUE_MODIFIED,
  LIST_ORDER_DATA_TYPE_CHANGED,
  LIST_ITEMS_ADDED,
  LIST_ITEMS_REMOVED,
  MANUAL_ASSERTION_FAILED,
  MANUAL_ASSERTION_EXCEPTION,
  HTTP_CLIENT_ERROR,
  ERROR_LIST_ORDER_CHANGED,
  ERROR_LIST_ORDER_CHANGED_VALUE_MODIFIED,
  ERROR_LIST_ORDER_DATA_TYPE_CHANGED,
  ERROR_LIST_ORDER_CHANGED_KEY_ADDED,
  ERROR_LIST_ORDER_CHANGED_KEY_REMOVED,
  ERROR_DATA_TYPE_CHANGED,
  ERROR_LIST_ITEMS_ADDED,
  ERROR_LIST_ITEMS_REMOVED,
  ERROR_VALUE_MODIFIED,
  ERROR_KEY_ADDED,
  ERROR_KEY_REMOVED,
}

DifferenceSection

Categorizes the type of difference detected:

enum DifferenceSection {
  ERROR,
  POST_IGNORED_NOISE,
  POST_IGNORED_ERROR,
  PRE_IGNORED_NOISE_DB,
  PRE_IGNORED_NOISE_CLI,
  PRE_IGNORED_ERROR_CLI,
  NOISY_ERROR,
}

RequestType

Represents the type of request that is being tested:

enum RequestType {
  UNKNOWN,
  ROOT_MOCK,
  HTTP,
  HTTP_2,
  GRAPHQL,
  GRPC,
  KAFKA,
  AMQP,
}

BodyType

Defines the body format used in the requests, such as JSON, Multipart, or Raw:

enum BodyType {
  JSON,
  MULTIPART,
  RAW,
}

HtGraphqlOpType

Represents the type of GraphQL operation in a GraphQL request:

enum HtGraphqlOpType {
  QUERY,
  MUTATION,
  SUBSCRIPTION,
}

HtRawEncoding

Specifies the encoding used for the message in a request's payload or response:

enum HtRawEncoding {
  NONE,
  UTF8,
  BASE64,
}

OutputStatus

Defines the status of the mock or response:

enum OutputStatus {
  ERROR,
  OKAY,
}

MockDifference

Describes the structure of the mock difference object, capturing the details of the difference between the original and replayed mocks:

type MockDifference = {
  mockIdentifier: string;
  replayMockId?: string;
  originalMockId?: bigint;
  mockType: MockType;
  differenceType: MockDifferenceType;
  severityScore: number;
  differenceSection: DifferenceSection;
  originalPath?: string[];
  newPath?: string[];
  evaluatedPath: string[];
  originalSchemaPath?: string[];
  newSchemaPath?: string[];
  differenceSchemaPath: string[];
  newValue?: any;  // Optional new value in the difference
  newValueHash?: string;
  originalValue?: any;  // Optional original value in the difference
  originalValueHash?: string;
};

ResponseDifference

Describes the structure of the response difference object, capturing details of the difference between the expected and actual responses:

type ResponseDifference = {
  requestType: RequestType;
  requestIdentifier: string;
  differenceType: DifferenceType;
  severityScore: number;
  differenceSection: DifferenceSection;
  originalPath?: string[];
  newPath?: string[];
  evaluatedPath: string[];
  originalSchemaPath?: string[];
  newSchemaPath?: string[];
  differenceSchemaPath: string[];
  newValue?: any;  // Optional new value in the difference
  newValueHash?: string;
  originalValue?: any;  // Optional original value in the difference
  originalValueHash?: string;
};

currentMock Type

The Mock represents the original mock that was recorded during testing.

Type Definition:

type Mock = {
  submoduleName: string;
  moduleName: string;
  id: bigint;
  OutputStatus: OutputStatus;
  readableInput: Record<string, any>;
  readableOutput: Record<string, any>;
  err: Record<string, any>;
};

requestObj Types

HTTP Request Object

Describes the components of an HTTP request recorded during testing:

type HttpRequestObj = {
  i_bodyType: BodyType,
  i_clusterPath: string,
  i_headers: Record<string, string>,
  i_method: string,
  i_path: string,
  i_query: Record<string, string>,
  id: bigint,
  i_host: string,
  i_jsonBody: Record<string, any>,
  requestType: RequestType,
  o_jsonBody: Record<string, any>,
  o_headers: Record<string, string>,
  o_statusCode: number,
  OutputStatus: OutputStatus,
};

GraphQL Request Object

Describes the components of a GraphQL request recorded during testing:

type GraphqlRequestObj = {
  i_gqlOpType: HtGraphqlOpType,
  i_gqlHeaders: Record<string, string>,
  i_gqlQuery: string,
  im_gqlOpName: string,
  i_gqlVars: Record<string, any>,
  i_gqlResolverChain: string[],
  id: bigint,
  o_data: Record<string, any>,
  o_error: Record<string, any>,
  requestType: RequestType,
  OutputStatus: OutputStatus,
};

GRPC Request Object

Describes the components of a GRPC request recorded during testing:

type GrpcRequestObj = {
  i_method: string,
  i_service: string,
  i_metaData: Record<string, any>,
  i_body: Record<string, any>,
  o_metaData: Record<string, any>,
  o_error: Record<string, any>,
  id: bigint,
  o_status: Record<string, any>,
  o_body: Record<string, any>,
  requestType: RequestType,
  OutputStatus: OutputStatus,
};

Kafka Request Object

Describes the components of a Kafka request recorded during testing:

type KafkaRequestObj = {
  i_groupId: string,
  i_highWaterMark: string,
  i_topic: string,
  i_jsonValue: Record<string, any>,
  i_headers: Record<string, string>,
  i_offset: string,
  id: bigint,
  i_timestamp: string,
  im_valueString: string,
  im_valueStringEncoding: HtRawEncoding,
  im_attributes: number,
  im_size: number,
  im_partition: number,
  requestType: RequestType,
  OutputStatus: OutputStatus,
};

AMQP Request Object

Describes the components of an AMQP request recorded during testing:

type AmqpRequestObj = {
  i_queue: string,
  i_msg: Record<string, any>,
  i_messageType: HtAmqpMessageType,
  i_options: Record<string, any>,
  im_ContentBufferBase64: string,
  OutputStatus: OutputStatus,
  id: bigint,
  requestType: RequestType,
};

Last updated