From 8d1a16012559e5b3e13cf091d960072be7becfb9 Mon Sep 17 00:00:00 2001 From: asyncapi-bot Date: Mon, 31 Jul 2023 10:20:23 +0200 Subject: [PATCH 1/2] docs(cli): update latest cli documentation (#2012) --- pages/docs/tools/cli/usage.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/pages/docs/tools/cli/usage.md b/pages/docs/tools/cli/usage.md index 741fef14e13..01f6093db8d 100644 --- a/pages/docs/tools/cli/usage.md +++ b/pages/docs/tools/cli/usage.md @@ -29,7 +29,7 @@ $ npm install -g @asyncapi/cli $ asyncapi COMMAND running command... $ asyncapi (--version) -@asyncapi/cli/0.51.2 linux-x64 node-v18.17.0 +@asyncapi/cli/0.51.3 linux-x64 node-v18.17.0 $ asyncapi --help [COMMAND] USAGE $ asyncapi COMMAND @@ -91,7 +91,7 @@ EXAMPLES $ asyncapi bundle ./asyncapi.yaml ./features.yaml --base ./asyncapi.yaml --reference-into-components ``` -_See code: [src/commands/bundle.ts](https://github.com/asyncapi/cli/blob/v0.51.2/src/commands/bundle.ts)_ +_See code: [src/commands/bundle.ts](https://github.com/asyncapi/cli/blob/v0.51.3/src/commands/bundle.ts)_ ## `asyncapi config` @@ -105,7 +105,7 @@ DESCRIPTION CLI config settings ``` -_See code: [src/commands/config/index.ts](https://github.com/asyncapi/cli/blob/v0.51.2/src/commands/config/index.ts)_ +_See code: [src/commands/config/index.ts](https://github.com/asyncapi/cli/blob/v0.51.3/src/commands/config/index.ts)_ ## `asyncapi config context` @@ -234,7 +234,7 @@ DESCRIPTION Convert asyncapi documents older to newer versions ``` -_See code: [src/commands/convert.ts](https://github.com/asyncapi/cli/blob/v0.51.2/src/commands/convert.ts)_ +_See code: [src/commands/convert.ts](https://github.com/asyncapi/cli/blob/v0.51.3/src/commands/convert.ts)_ ## `asyncapi diff OLD NEW` @@ -289,7 +289,7 @@ DESCRIPTION Find diff between two asyncapi files ``` -_See code: [src/commands/diff.ts](https://github.com/asyncapi/cli/blob/v0.51.2/src/commands/diff.ts)_ +_See code: [src/commands/diff.ts](https://github.com/asyncapi/cli/blob/v0.51.3/src/commands/diff.ts)_ ## `asyncapi generate` @@ -303,7 +303,7 @@ DESCRIPTION Generate typed models or other things like clients, applications or docs using AsyncAPI Generator templates. ``` -_See code: [src/commands/generate/index.ts](https://github.com/asyncapi/cli/blob/v0.51.2/src/commands/generate/index.ts)_ +_See code: [src/commands/generate/index.ts](https://github.com/asyncapi/cli/blob/v0.51.3/src/commands/generate/index.ts)_ ## `asyncapi generate fromTemplate ASYNCAPI TEMPLATE` @@ -432,7 +432,7 @@ DESCRIPTION Creates a new asyncapi file ``` -_See code: [src/commands/new/index.ts](https://github.com/asyncapi/cli/blob/v0.51.2/src/commands/new/index.ts)_ +_See code: [src/commands/new/index.ts](https://github.com/asyncapi/cli/blob/v0.51.3/src/commands/new/index.ts)_ ## `asyncapi new file` @@ -520,7 +520,7 @@ EXAMPLES $ asyncapi optimize ./asyncapi.yaml --optimization=remove-components,reuse-components,move-to-components --output=terminal --no-tty ``` -_See code: [src/commands/optimize.ts](https://github.com/asyncapi/cli/blob/v0.51.2/src/commands/optimize.ts)_ +_See code: [src/commands/optimize.ts](https://github.com/asyncapi/cli/blob/v0.51.3/src/commands/optimize.ts)_ ## `asyncapi start` @@ -534,7 +534,7 @@ DESCRIPTION Start asyncapi studio ``` -_See code: [src/commands/start/index.ts](https://github.com/asyncapi/cli/blob/v0.51.2/src/commands/start/index.ts)_ +_See code: [src/commands/start/index.ts](https://github.com/asyncapi/cli/blob/v0.51.3/src/commands/start/index.ts)_ ## `asyncapi start studio` @@ -578,5 +578,5 @@ DESCRIPTION validate asyncapi file ``` -_See code: [src/commands/validate.ts](https://github.com/asyncapi/cli/blob/v0.51.2/src/commands/validate.ts)_ +_See code: [src/commands/validate.ts](https://github.com/asyncapi/cli/blob/v0.51.3/src/commands/validate.ts)_ From 4d92a680be8c530ea624c02370893754e95d5883 Mon Sep 17 00:00:00 2001 From: Aadrika Bhargava <64789514+reachaadrika@users.noreply.github.com> Date: Tue, 1 Aug 2023 02:02:09 +0530 Subject: [PATCH 2/2] feat: adding unit tests for editor component (#1885) Co-authored-by: Akshat Nema <76521428+akshatnema@users.noreply.github.com> --- components/editor/CodeBlock.js | 4 ++-- cypress/test/editor/CodeBlock.cy.js | 30 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 cypress/test/editor/CodeBlock.cy.js diff --git a/components/editor/CodeBlock.js b/components/editor/CodeBlock.js index b0e19db2234..974c2285c52 100644 --- a/components/editor/CodeBlock.js +++ b/components/editor/CodeBlock.js @@ -104,8 +104,8 @@ export default function CodeBlock({ { showCopy && (
-
diff --git a/cypress/test/editor/CodeBlock.cy.js b/cypress/test/editor/CodeBlock.cy.js new file mode 100644 index 00000000000..825960baead --- /dev/null +++ b/cypress/test/editor/CodeBlock.cy.js @@ -0,0 +1,30 @@ +import { mount } from 'cypress/react' +import CodeBlock from '../../../components/editor/CodeBlock' + +describe('CodeBlock component', () => { + beforeEach(() => { + mount( + + { `const message = 'Hello, World!';\nconsole.log(message);` } + + ) + }); + + it('should render correctly', () => { + cy.get('.bg-code-editor-dark').should('exist') + + }) + it('should copy code to clipboard when clicking the copy button', () => { + const copiedText = "const message = 'Hello, World!';\r\nconsole.log(message);" + + cy.get('[data-test="copy-button"]').click({force:true}) + cy.get('[data-testid="clicked-text"]').should('exist'); + + cy.window().then((win) => { + cy.document().then((doc) => { + cy.wrap(win.navigator.clipboard.readText()).should('eq', copiedText) + }) + }) + }) + +})