/** * Apimatic APILib * * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). */ import { array, boolean, lazy, optional, Schema, string, typedExpandoObject, unknown, } from '../schema.js'; import { InputParameter, inputParameterSchema } from './inputParameter.js'; /** APIMatic lets you define test cases for endpoints using the API Editor. The test cases are automatically generated for each language. This structure encapsulates all details of a Test Case. To find out more about defining Test Cases visit: https://docs.apimatic.io/testing/defining-your-first-test-case/ */ export interface TestCase { /** Unique Test Case identifier */ id: string; /** The Endpoint, test case is associated with */ endpointId: string; /** The API Entity, test case is associated with */ apiId: string; /** The Test Case name */ name: string; /** Enable/Disable a Test Case */ enabled: boolean; shouldPass: boolean; /** Test case parameters */ inputParameters: InputParameter[]; /** Expected response status. We expect the status code to be 200 if the operation is successful, hence we input the value 200. */ expectedStatus: string; /** Expected Headers */ expectedHeaders: string[]; /** If this flag is disabled, it will cause the test case to fail if the response contains other headers than those listed in the expected headers list. */ expectedHeadersAllowExtra: boolean; /** Expected response goes in the expected body */ expectedBody: string; /** Specifies what to match */ expectedBodyMatchMode: string; /** If enabled, this will involve ensuring that the response body contains the array elements in the same order as the expected body. */ expectedArrayOrderedMatching: boolean; /** If enabled, this will ensure that the response body contains the same number of elements in the array as does the expected body. */ expectedArrayCheckCount: boolean; responseMatchSchema: boolean; additionalProperties?: Record; } export const testCaseSchema: Schema = lazy(() => typedExpandoObject( { id: ['id', string()], endpointId: ['endpointId', string()], apiId: ['apiId', string()], name: ['name', string()], enabled: ['enabled', boolean()], shouldPass: ['shouldPass', boolean()], inputParameters: ['inputParameters', array(inputParameterSchema)], expectedStatus: ['expectedStatus', string()], expectedHeaders: ['expectedHeaders', array(string())], expectedHeadersAllowExtra: ['expectedHeadersAllowExtra', boolean()], expectedBody: ['expectedBody', string()], expectedBodyMatchMode: ['expectedBodyMatchMode', string()], expectedArrayOrderedMatching: ['expectedArrayOrderedMatching', boolean()], expectedArrayCheckCount: ['expectedArrayCheckCount', boolean()], responseMatchSchema: ['responseMatchSchema', boolean()], }, 'additionalProperties', optional(unknown()) ) );