2020-09-25 10:54:39 +02:00

48 lines
1.4 KiB
JavaScript

'use strict';
const OpenAPI = require('../dist');
const glob = require('glob');
const fs = require('fs');
describe('v2', () => {
it('should generate', async () => {
await OpenAPI.generate({
input: './test/spec/v2.json',
output: './test/generated/v2/',
httpClient: OpenAPI.HttpClient.FETCH,
useOptions: false,
useUnionTypes: false,
exportCore: true,
exportSchemas: true,
exportModels: true,
exportServices: true,
});
glob.sync('./test/generated/v2/**/*.ts').forEach(file => {
const content = fs.readFileSync(file, 'utf8').toString();
expect(content).toMatchSnapshot(file);
});
});
});
describe('v3', () => {
it('should generate', async () => {
await OpenAPI.generate({
input: './test/spec/v3.json',
output: './test/generated/v3/',
httpClient: OpenAPI.HttpClient.FETCH,
useOptions: false,
useUnionTypes: false,
exportCore: true,
exportSchemas: true,
exportModels: true,
exportServices: true,
});
glob.sync('./test/generated/v3/**/*.ts').forEach(file => {
const content = fs.readFileSync(file, 'utf8').toString();
expect(content).toMatchSnapshot(file);
});
});
});