Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
19 changes: 19 additions & 0 deletions packages/components/test/components/Installation.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
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 />);
expect(result.trim()).toMatchSnapshot();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
expect(result.trim()).toMatchSnapshot();
expect(actual).toBe('');

Until we don't have proper error handling no need to match snapshot.

});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Installation component renders installation section when language is undefined 1`] = `
"## Installation

Install dependencies:

\`\`\`bash
undefined
\`\`\`"
`;

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
\`\`\`"
`;