Skip to content

Commit 3d9534e

Browse files
test: add tests for Installation README component (#1945)
Co-authored-by: SHUBHANSHU602 <shubhanshusingh602@gmail.com> Co-authored-by: Adi Boghawala <adiboghawala@gmail.com>
1 parent 2d23c7e commit 3d9534e

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { render } from '@asyncapi/generator-react-sdk';
2+
import { Installation } from '../../src/components/readme/Installation';
3+
4+
describe('Installation component', () => {
5+
test('renders javascript installation command', () => {
6+
const result = render(<Installation language="javascript" />);
7+
expect(result.trim()).toMatchSnapshot();
8+
});
9+
10+
test('renders python installation command', () => {
11+
const result = render(<Installation language="python" />);
12+
expect(result.trim()).toMatchSnapshot();
13+
});
14+
15+
test('renders installation section when language is undefined', () => {
16+
const result = render(<Installation />);
17+
const output = result.trim();
18+
19+
// Explicitly document current behavior
20+
expect(output).toContain('## Installation');
21+
expect(output).toContain('Install dependencies');
22+
expect(output).toContain('undefined');
23+
});
24+
});
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Installation component renders javascript installation command 1`] = `
4+
"## Installation
5+
6+
Install dependencies:
7+
8+
\`\`\`bash
9+
npm install
10+
\`\`\`"
11+
`;
12+
13+
exports[`Installation component renders python installation command 1`] = `
14+
"## Installation
15+
16+
Install dependencies:
17+
18+
\`\`\`bash
19+
pip install -r requirements.txt
20+
\`\`\`"
21+
`;

0 commit comments

Comments
 (0)