diff --git a/packages/components/test/components/Installation.test.js b/packages/components/test/components/Installation.test.js new file mode 100644 index 000000000..5f3843ed2 --- /dev/null +++ b/packages/components/test/components/Installation.test.js @@ -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(); + expect(result.trim()).toMatchSnapshot(); + }); + + test('renders python installation command', () => { + const result = render(); + expect(result.trim()).toMatchSnapshot(); + }); + + test('renders installation section when language is undefined', () => { + const result = render(); + const output = result.trim(); + + // Explicitly document current behavior + expect(output).toContain('## Installation'); + expect(output).toContain('Install dependencies'); + expect(output).toContain('undefined'); + }); +}); \ No newline at end of file diff --git a/packages/components/test/components/__snapshots__/Installation.test.js.snap b/packages/components/test/components/__snapshots__/Installation.test.js.snap new file mode 100644 index 000000000..1d273eed9 --- /dev/null +++ b/packages/components/test/components/__snapshots__/Installation.test.js.snap @@ -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 +\`\`\`" +`;