openapi-codegen-typescript
Version:
OpenApi codegen for generating types an mocks from swagger json file
62 lines (61 loc) • 2.03 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var getResultStringForExportInterface_1 = require("./getResultStringForExportInterface");
var scenarios = [
{
input: {
schemaKey: 'schemaKey mocked',
schema: {
description: 'description mocked',
properties: {
type: 'type mocked',
},
},
interfaces: ['first', 'second', 'third'],
},
output: "/**\n * description mocked\n */\nexport interface schemaKey mocked extends first, second, third {\n",
},
{
input: {
schemaKey: 'schemaKey mocked',
schema: {
description: 'description mocked',
properties: {
type: 'type mocked',
},
},
interfaces: undefined,
},
output: "/**\n * description mocked\n */\nexport interface schemaKey mocked {\n",
},
{
input: {
schemaKey: undefined,
schema: {
description: 'description mocked',
properties: {
type: 'type mocked',
},
},
interfaces: ['first', 'second', 'third'],
},
output: "/**\n * description mocked\n */\nexport interface undefined extends first, second, third {\n",
},
{
input: {
schemaKey: 'schemaKey mocked',
schema: {
properties: {
type: 'type mocked',
},
},
interfaces: ['first', 'second', 'third'],
},
output: "export interface schemaKey mocked extends first, second, third {\n",
},
];
it.each(scenarios)("should return expected string", function (_a) {
var input = _a.input, output = _a.output;
var result = getResultStringForExportInterface_1.getResultStringForExportInterface(input);
expect(result).toBe(output);
});