Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add unit tests for AlgoliaSearch,GeneratorInstallation and OpenAPIComparison component #1916

Merged
merged 18 commits into from
Jul 17, 2023

Conversation

reachaadrika
Copy link
Contributor

Description

  • AlgoliaSearch : This is the search component for website .

  • GeneratorInstallation : This generates the content for the editor component .
    image

  • OpenAPIComparison : This component is part of the Docs Layout and I have tested for hover and matching colors of the component .
    image

Related issue(s)
fixes #1915

@netlify
Copy link

netlify bot commented Jul 7, 2023

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 2a12993
🔍 Latest deploy log https://app.netlify.com/sites/asyncapi-website/deploys/64b558c4aa53f30008dbf9f9
😎 Deploy Preview https://deploy-preview-1916--asyncapi-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@github-actions
Copy link

github-actions bot commented Jul 7, 2023

⚡️ Lighthouse report for the changes in this PR:

Category Score
🔴 Performance 46
🟢 Accessibility 98
🟢 Best practices 100
🟢 SEO 100
🔴 PWA 30

Lighthouse ran on https://deploy-preview-1916--asyncapi-website.netlify.app/

@akshatnema akshatnema added the gsoc This label should be used for issues or discussions related to ideas for Google Summer of Code label Jul 11, 2023
<div className="flex-1 border border-black p-2 mr-1">
<h3 className="text-lg font-sans font-medium mb-4 ml-2">OpenAPI 3.0</h3>

<div>
<div className={(hoverState.Info ? `bg-blue-100 ` : ` `) + `border border-blue-300 p-2 m-2`} onMouseOver={() => setHoverState(prevState => ({ ...prevState, Info: true }))} onMouseLeave={() => setHoverState({ ...hoverState, Info: false })}>
<div className={ (hoverState.Info ? `bg-blue-100 ` : ` `) + `border border-blue-300 p-2 m-2` } onMouseOver={ () => setHoverState(prevState => ({ ...prevState, Info: true })) } onMouseLeave={ () => setHoverState({ ...hoverState, Info: false }) } data-testid="OpenAPI-sec1">
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
<div className={ (hoverState.Info ? `bg-blue-100 ` : ` `) + `border border-blue-300 p-2 m-2` } onMouseOver={ () => setHoverState(prevState => ({ ...prevState, Info: true })) } onMouseLeave={ () => setHoverState({ ...hoverState, Info: false }) } data-testid="OpenAPI-sec1">
<div className={ (hoverState.Info ? `bg-blue-100 ` : ` `) + `border border-blue-300 p-2 m-2` } onMouseOver={ () => setHoverState(prevState => ({ ...prevState, Info: true })) } onMouseLeave={ () => setHoverState({ ...hoverState, Info: false }) } data-testid="OpenAPI-sec-info">

Don't make the test ids as 1,2,3..., use the correct names to identify them easily.

Applicable everywhere.

Copy link
Member

Choose a reason for hiding this comment

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

import AlgoliaSearch from '../../components/AlgoliaSearch'
describe('AlgoliaSearch component', () => {
it('renders without errors', () => {
mount(<AlgoliaSearch />);
Copy link
Member

Choose a reason for hiding this comment

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

You have to use SearchButton inside AlgoliaSearch to test the component.

Also, derive a case where it searches for certain page inside docs, by typing it in the search box.

<div className="flex-1 border border-black p-2 mr-1">
<h3 className="text-lg font-sans font-medium mb-4 ml-2">OpenAPI 3.0</h3>

<div>
<div className={(hoverState.Info ? `bg-blue-100 ` : ` `) + `border border-blue-300 p-2 m-2`} onMouseOver={() => setHoverState(prevState => ({ ...prevState, Info: true }))} onMouseLeave={() => setHoverState({ ...hoverState, Info: false })}>
<div className={ (hoverState.Info ? `bg-blue-100 ` : ` `) + `border border-blue-300 p-2 m-2` } onMouseOver={ () => setHoverState(prevState => ({ ...prevState, Info: true })) } onMouseLeave={ () => setHoverState({ ...hoverState, Info: false }) } data-testid="OpenAPI-sec1">
Copy link
Member

Choose a reason for hiding this comment

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

@akshatnema
Copy link
Member

@reachaadrika Kindly resolve the conflicts in this.

@akshatnema akshatnema changed the title feat: adding unit tests for AlgoliaSearch,GeneratorInstallation and OpenAPIComparison component feat: add unit tests for AlgoliaSearch,GeneratorInstallation and OpenAPIComparison component Jul 16, 2023
@reachaadrika
Copy link
Contributor Author

@reachaadrika Kindly resolve the conflicts in this.

@akshatnema resolved


cy.get('input[placeholder="Search resources"]').type('welcome')
cy.should('have.value', 'welcome')
});
Copy link
Member

Choose a reason for hiding this comment

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

Add the check of getting Welcome inside the docsearch-list ul list of DOM.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@akshatnema
Copy link
Member

/rtm

@asyncapi-bot asyncapi-bot merged commit 103a859 into asyncapi:master Jul 17, 2023
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gsoc This label should be used for issues or discussions related to ideas for Google Summer of Code ready-to-merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add unit tests for AlgoliaSearch , GeneratorInstallation and OpenAPIComparison
4 participants