Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions packages/components/test/components/Installation.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { render } from '@asyncapi/generator-react-sdk';
import { Installation } from '../../src/components/readme/Installation';

describe('Installation component', () => {
test('renders javascript installation command', () => {
const result = render(<Installation language="javascript" />);
expect(result.trim()).toMatchSnapshot();
});

test('renders python installation command', () => {
const result = render(<Installation language="python" />);
expect(result.trim()).toMatchSnapshot();
});

test('renders installation section when language is undefined', () => {
const result = render(<Installation />);
const output = result.trim();

// Explicitly document current behavior
expect(output).toContain('## Installation');
expect(output).toContain('Install dependencies');
expect(output).toContain('undefined');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Installation component renders javascript installation command 1`] = `
"## Installation

Install dependencies:

\`\`\`bash
npm install
\`\`\`"
`;

exports[`Installation component renders python installation command 1`] = `
"## Installation

Install dependencies:

\`\`\`bash
pip install -r requirements.txt
\`\`\`"
`;