chore: add test for build with url and improve file-naming

This commit is contained in:
Alex Varchuk 2022-05-12 11:29:36 +03:00
parent 7ceb434034
commit 754688ba60
3 changed files with 27 additions and 2 deletions

View File

@ -5,7 +5,7 @@ describe('build', () => {
it('should use .redocly.yaml', () => {
const r = spawnSync(
'ts-node',
['../../../index.ts', 'build', ' ../../../../demo/openapi.yaml', '--output=redocTest.html'],
['../../../index.ts', 'build', ' ../../../../demo/openapi.yaml', '--output=redoc-test.html'],
{
cwd: __dirname,
shell: true,
@ -17,7 +17,7 @@ describe('build', () => {
const result = `${out}\n${err}`;
try {
const redocStaticFile = readFileSync(`${__dirname}/redocTest.html`, 'utf8');
const redocStaticFile = readFileSync(`${__dirname}/redoc-test.html`, 'utf8');
expect(redocStaticFile).toContain('"options":{"disableSearch":true}');
expect(redocStaticFile).not.toContain('role="search"');
} catch (err) {

View File

@ -0,0 +1,25 @@
import { spawnSync } from 'child_process';
describe('build with url', () => {
// FIXME: remove skip after release
it.skip('should not fail on resolving url', () => {
const r = spawnSync(
'ts-node',
[
'../../../index.js',
'build',
'http://petstore.swagger.io/v2/swagger.json',
'--output=url-test.html',
],
{
cwd: __dirname,
shell: true,
},
);
const out = r.stdout.toString('utf-8');
const err = r.stderr.toString('utf-8');
const result = `${out}\n${err}`;
expect(result).toContain('bundled successfully');
});
});