UNPKG

pact-gen-ts

Version:

Generating pact files from typescript definitions

20 lines (19 loc) 1.1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PactAxiosRequestBody = void 0; const type_representation_1 = require("../../core/type-representation"); const create_pact_example_object_1 = require("../../core/create-pact-example-object"); const create_pact_matching_rules_1 = require("../../core/create-pact-matching-rules"); const body_1 = require("../../core/body"); class PactAxiosRequestBody extends body_1.Body { constructor(axios, sourceFile) { super(); const requestBodyType = axios.getRequestBodyType(); if (requestBodyType) { const basicTypeRepresentationOfRequestBody = (0, type_representation_1.getTypeRepresentation)(requestBodyType, sourceFile); this.body = (0, create_pact_example_object_1.changeObjectRepresentationIntoExample)(basicTypeRepresentationOfRequestBody); this.matchingRules = (0, create_pact_matching_rules_1.changeObjectRepresentationIntoMatchingRules)(basicTypeRepresentationOfRequestBody, '$.body'); } } } exports.PactAxiosRequestBody = PactAxiosRequestBody;