File tree Expand file tree Collapse file tree 2 files changed +50
-0
lines changed
packages/components/test/components Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ import path from 'path' ;
2+ import { render } from '@asyncapi/generator-react-sdk' ;
3+ import { Parser , fromFile } from '@asyncapi/parser' ;
4+ import { getServer , getServerUrl } from '@asyncapi/generator-helpers' ;
5+ import { Overview } from '../../src/components/readme/Overview' ;
6+
7+ const parser = new Parser ( ) ;
8+ const asyncapi_websocket_query = path . resolve ( __dirname , '../../../helpers/test/__fixtures__/asyncapi-websocket-query.yml' ) ;
9+
10+ describe ( 'Testing of Overview component' , ( ) => {
11+ let parsedAsyncAPIDocument ;
12+ let info ;
13+ let title ;
14+ let serverUrl ;
15+
16+ beforeAll ( async ( ) => {
17+ const parseResult = await fromFile ( parser , asyncapi_websocket_query ) . parse ( ) ;
18+ parsedAsyncAPIDocument = parseResult . document ;
19+
20+ info = parsedAsyncAPIDocument . info ( ) ;
21+ title = info . title ( ) ;
22+
23+ const server = getServer ( parsedAsyncAPIDocument . servers ( ) , 'withHostDuplicatingProtocol' ) ;
24+ serverUrl = getServerUrl ( server ) ;
25+ } ) ;
26+
27+ test ( 'render overview with description correctly' , ( ) => {
28+ const result = render (
29+ < Overview
30+ info = { info }
31+ title = { title }
32+ serverUrl = { serverUrl }
33+ />
34+ ) ;
35+
36+ const actual = result . trim ( ) ;
37+ expect ( actual ) . toMatchSnapshot ( ) ;
38+ } ) ;
39+ } ) ;
Original file line number Diff line number Diff line change 1+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+ exports [` Testing of Overview component render overview with description correctly 1` ] = `
4+ "## Overview
5+
6+ Market data is a public API that streams all the market data on a given symbol.
7+
8+
9+ - **Version:** 1.0.0
10+ - **Server URL:** wss://api.gemini.com"
11+ ` ;
You can’t perform that action at this time.
0 commit comments