From 80713c8d30ca44c6e14092fcbb989a4c8b9d4572 Mon Sep 17 00:00:00 2001 From: "jonas-lt@live.dk" Date: Wed, 13 Sep 2023 09:36:17 +0200 Subject: [PATCH] update tests --- helpers/all.js | 6 +++--- test/helpers/all.test.js | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/helpers/all.js b/helpers/all.js index cf9353ecb..83385f6ab 100644 --- a/helpers/all.js +++ b/helpers/all.js @@ -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) { @@ -149,7 +149,7 @@ export function stringifyConfiguration(params) { export function renderSpec(asyncapi, params) { loadLanguagesConfig(); const config = prepareConfiguration(params); - //const component = ; - const component = <> + const component = ; + //const component = <> return ReactDOMServer.renderToString(component); } diff --git a/test/helpers/all.test.js b/test/helpers/all.test.js index c5e8af171..a37e194c3 100644 --- a/test/helpers/all.test.js +++ b/test/helpers/all.test.js @@ -1,5 +1,5 @@ import { hljs } from '@asyncapi/react-component'; -import { createAsyncAPIDocument } from "@asyncapi/parser"; +import { AsyncAPIDocumentV2, createAsyncAPIDocument } from "@asyncapi/parser"; import { includeFile, @@ -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); + }); + }); });