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: adding unit tests for form and slack folders #1775

Merged
merged 26 commits into from
Jul 10, 2023

Conversation

reachaadrika
Copy link
Contributor

Description

  • Form == > Select : This component basically has a select dropdown which is used as utility in many other components , here I added the following tests :
  1. should call onChange when an option is selected
  2. should render options correctly ( for this test I hardcoded and selected option 2 only and check if it has filtered or not)

image

  • **slack == > index.js ** : Included the tests to check if all the message components are rendered successfully .
    image

  • slack == > message.js : Included the tests to check the reactions , and other related stuff , took a dummy reaction array for this
    image

Related issue(s)
fixes #1774

@netlify
Copy link

netlify bot commented Jun 12, 2023

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 5179ac9
🔍 Latest deploy log https://app.netlify.com/sites/asyncapi-website/deploys/64ac4cdeb7554a0008dc10f8
😎 Deploy Preview https://deploy-preview-1775--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.

@reachaadrika reachaadrika changed the title feat:adding tests for both components feat: adding unit tests for form and slack folders Jun 12, 2023
@github-actions
Copy link

github-actions bot commented Jun 12, 2023

⚡️ Lighthouse report for the changes in this PR:

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

Lighthouse ran on https://deploy-preview-1775--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 Jun 16, 2023
{ reaction.icon ? (<img className="inline-block -mt-0.5 w-4 h-4 object-contain" src={reaction.icon} alt={reaction.name}/>) : (<span className="text-xs mr-1">{reaction.emoji}</span>) }
<span className="inline-block text-blue-500 font-bold ml-1 text-xs">{reaction.count}</span>
<div key={index} className={`inline px-2 py-0.5 mr-1 rounded-xl ${reaction.mine ? 'bg-blue-50 border border-blue-500' : 'bg-gray-100'}`} data-testid="SlackMessage-reaction">
{ reaction.icon ? (<img className="inline-block -mt-0.5 w-4 h-4 object-contain" src={reaction.icon} alt={reaction.name} data-testid="SlackMessage-img2" />) : (<span className="text-xs mr-1" data-testid="SlackMessage-span">{reaction.emoji}</span>) }
Copy link
Member

Choose a reason for hiding this comment

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

Don't make the data-testid in the form of numbers. Make it specific which img it is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay Will do the changes

Comment on lines 9 to 11
{ emoji: '👍', count: 5 },
{ emoji: '❤️', count: 3 },
// Add more reactions
Copy link
Member

Choose a reason for hiding this comment

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

Use a sample avatar icon as well from the assets folder to test the image as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure , the author images ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you brief a little bit more about this ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added dummy path for avatar , in assets folder where can I get the image ?

cypress/test/slack/index.cy.js Outdated Show resolved Hide resolved
@@ -0,0 +1,37 @@
import { mount } from '@cypress/react'
Copy link
Member

Choose a reason for hiding this comment

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

Rename this file to Message.cy.js.

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

@reachaadrika
Copy link
Contributor Author

/rtm

@asyncapi-bot asyncapi-bot merged commit 4090841 into asyncapi:master Jul 10, 2023
11 checks passed
@akshatnema
Copy link
Member

@allcontributors please add @reachaadrika for code

@allcontributors
Copy link
Contributor

@akshatnema

I've put up a pull request to add @reachaadrika! 🎉

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 'slack' and 'form' component
3 participants