Skip to content

Commit

Permalink
chore: add test for build with url and improve file-naming
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexVarchuk committed May 12, 2022
1 parent 7ceb434 commit 754688b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cli/__test__/build/configRedoc/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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) {
Expand Down
25 changes: 25 additions & 0 deletions cli/__test__/build/configRedoc/url.test.ts
Original file line number Diff line number Diff line change
@@ -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');
});
});

0 comments on commit 754688b

Please sign in to comment.