Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaslagoni committed Sep 13, 2023
1 parent 4a938c8 commit 80713c8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
6 changes: 3 additions & 3 deletions helpers/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import path from 'path';
import fs from 'fs';
import ReactDOMServer from 'react-dom/server';
import fetch from 'sync-fetch';
import { hljs } from '@asyncapi/react-component';
import AsyncApiComponent, { hljs } from '@asyncapi/react-component';
import {stringify} from '@asyncapi/parser';

function isJsonObject(o) {
Expand Down Expand Up @@ -149,7 +149,7 @@ export function stringifyConfiguration(params) {
export function renderSpec(asyncapi, params) {
loadLanguagesConfig();
const config = prepareConfiguration(params);
//const component = <AsyncApiComponent schema={asyncapi} config={config}/>;
const component = <></>
const component = <AsyncApiComponent schema={asyncapi} config={config}/>;
//const component = <></>
return ReactDOMServer.renderToString(component);
}
17 changes: 16 additions & 1 deletion test/helpers/all.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { hljs } from '@asyncapi/react-component';
import { createAsyncAPIDocument } from "@asyncapi/parser";
import { AsyncAPIDocumentV2, createAsyncAPIDocument } from "@asyncapi/parser";

import {
includeFile,
Expand Down Expand Up @@ -135,4 +135,19 @@ describe('Helpers', () => {
expect(result).toEqual(expected);
});
});

describe('.renderSpec', () => {
it.skip('should work', async () => {
const schema = new AsyncAPIDocumentV2({
asyncapi: '2.0.0',
info: { title: 'test', version: '0.0.0' },
channels: {},
});
const result = renderSpec(schema);
// check if '1.5.34' version is rendered
expect(result.includes('1.5.34')).toEqual(true);
// check if 'dummy spec for testing' title is rendered
expect(result.includes('dummy spec')).toEqual(true);
});
});
});

0 comments on commit 80713c8

Please sign in to comment.