mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-28 19:43:43 +03:00
d2cdaa1221
Co-authored-by: Andrew Tatomyr <andrew.tatomyr@redocly.com> Co-authored-by: Alex Varchuk <olexandr.varchuk@gmail.com> Co-authored-by: Anastasiia Derymarko <anastasiia@redocly.com>
31 lines
975 B
TypeScript
31 lines
975 B
TypeScript
import { spawnSync } from 'child_process';
|
|
import { readFileSync } from 'fs';
|
|
|
|
describe('build', () => {
|
|
it('should use .redocly.yaml', () => {
|
|
const r = spawnSync(
|
|
'ts-node',
|
|
['../../../index.ts', 'build', ' ../../../../demo/openapi.yaml', '--output=redoc-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}`;
|
|
|
|
try {
|
|
const redocStaticFile = readFileSync(`${__dirname}/redoc-test.html`, 'utf8');
|
|
expect(redocStaticFile).toContain('"options":{"disableSearch":true}');
|
|
expect(redocStaticFile).not.toContain('role="search"');
|
|
} catch (err) {
|
|
expect(err.toString()).toContain('{"options":{"disableSearch":"true"}');
|
|
}
|
|
|
|
expect(result).toContain('Found .redocly.yaml and using features.openapi options');
|
|
expect(result).toContain('bundled successfully');
|
|
});
|
|
});
|