@bluejeans/flexdoc-backend
Version:
FlexDoc backend integration for NestJS and other frameworks
40 lines • 1.63 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const template_1 = require("./template");
describe('generateFlexDocHTML', () => {
it('should generate HTML with embedded spec when provided', () => {
const spec = {
openapi: '3.0.0',
info: {
title: 'Test API',
version: '1.0.0',
},
paths: {},
};
const html = (0, template_1.generateFlexDocHTML)(spec);
expect(html).toContain('<!DOCTYPE html>');
expect(html).toContain('<title>Test API</title>');
expect(html).toContain('window.__FLEXDOC_SPEC__');
expect(html).toContain(JSON.stringify(spec));
});
it('should include specUrl when provided', () => {
const specUrl = 'https://example.com/openapi.json';
const html = (0, template_1.generateFlexDocHTML)(null, { specUrl });
expect(html).toContain('window.__FLEXDOC_SPEC_URL__');
expect(html).toContain(specUrl);
});
it('should include theme options when provided', () => {
const options = {
theme: 'dark',
};
const html = (0, template_1.generateFlexDocHTML)(null, options);
expect(html).toContain('window.__FLEXDOC_OPTIONS__');
expect(html).toContain(JSON.stringify(options));
});
it('should handle null spec gracefully', () => {
const html = (0, template_1.generateFlexDocHTML)(null);
expect(html).toContain('<!DOCTYPE html>');
expect(html).toContain('window.__FLEXDOC_SPEC__ = null');
});
});
//# sourceMappingURL=template.test.js.map