fluentrest-ts
Version:
A lightweight, fluent TypeScript API testing library inspired by Java's RestAssured. Built on top of Axios, JSONPath, and Joi for powerful request handling and response validation.
24 lines (23 loc) • 1.16 kB
TypeScript
import { AxiosResponse } from "axios";
import Joi from "joi";
import { LogLevel } from "../core/logger";
/**
* Asserts that the response status code matches the expected status.
*/
export declare function expectStatus(response: AxiosResponse, status: number, logLevel: LogLevel, logToFile: boolean): void;
/**
* Asserts that a value at a JSONPath in the body matches the expected value.
*/
export declare function expectBody(response: AxiosResponse, path: string, expected: any, logLevel: LogLevel, logToFile: boolean): void;
/**
* Asserts that a response header matches the expected value.
*/
export declare function expectHeader(response: AxiosResponse, headerKey: string, expectedValue: string, logLevel: LogLevel, logToFile: boolean): void;
/**
* Asserts that the response body contains the specified key-value fragment.
*/
export declare function expectBodyContains(response: AxiosResponse, fragment: object, logLevel: LogLevel, logToFile: boolean): void;
/**
* Validates the full response body against a Joi schema.
*/
export declare function validateBody(response: AxiosResponse, schema: Joi.Schema, logLevel: LogLevel, logToFile: boolean): void;