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 sponsors component #1804

Merged
merged 15 commits into from
Jul 10, 2023

Conversation

reachaadrika
Copy link
Contributor

Description

  • Sponsors , part of the website had 3 sections divided within it :
  1. Gold Sponsors
  2. Silver Sponsors
  3. Sponsors

All these were standalone files in the codebase , for ease of navigation and additional refactoring , I added these files into a single folder and updated the imports , so that this is not a breaking change .

  • Along with this for writing unit tests , the code required some additional refactoring , earlier each sponsor was added separately in an li tag with image associated with , I instead of following this approach created an array of sponsors with all necessary classes and fetched and mapped the data through it . So that we need to change the data and testcases , if a new sponsor is added to the list in future . We could update the array , and it would reflect both in application code as well as the test file .

  • For this I created 3 files : SponsorsList.js , GoldSponsorsList.js and SilverSponsorsList.js .

  • Further following are the tests and test files for each of the Sponsors file :

  1. Sponsors.js :
    Here I included the following test cases :
  • renders sponsors correctly
  • shows support banner when showSupportBanner prop is true
  • does not show support banner when showSupportBanner prop is false

image
image

  1. GoldSponsors.js**
    Here are the tests that I included :
    -renders the gold sponsors
    image

  2. SilverSponsors.js

  • renders silver sponsors correctly
    image

NOTE : Along with unit tests this PR includes additional code refactoring

Related issue(s)
fixes #1803

@netlify
Copy link

netlify bot commented Jun 18, 2023

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit ba80b6f
🔍 Latest deploy log https://app.netlify.com/sites/asyncapi-website/deploys/64aaed47ecfb120008f4e8dc
😎 Deploy Preview https://deploy-preview-1804--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 Jun 18, 2023

⚡️ Lighthouse report for the changes in this PR:

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

Lighthouse ran on https://deploy-preview-1804--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 19, 2023
@@ -0,0 +1,37 @@
import { mount } from 'cypress/react';
Copy link
Member

@akshatnema akshatnema Jul 8, 2023

Choose a reason for hiding this comment

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

Make the filename as Sponsors.cy.js.

@akshatnema
Copy link
Member

/rtm

@asyncapi-bot asyncapi-bot merged commit e5e9c78 into asyncapi:master Jul 10, 2023
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 sponsors folder .
3 participants