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 docsCards and feature folders #1763

Merged
merged 12 commits into from
Jun 17, 2023

Conversation

reachaadrika
Copy link
Contributor

@reachaadrika reachaadrika commented Jun 8, 2023

Description
This pull request includes tests for 2 components of website docs (DocsCards.js ) and features ( index.jsx ) .

  1. docs ==> DocsCards.js : This component displays the doc headings , and displays this and takes value from an array named "cards" , and displays in form of cards on the screen . For this I have included the following tests :
  • renders the correct number of cards
  • renders card titles and descriptions correctly
  • navigates to the correct link on card click
  • renders each icon correctly
    image
    image
  1. features ==> index.jsx : This component also displays the feature cards , with headings and a small description . It also fetches the values from a constant feature array . For this I have included the following tests :
    -renders all features with their names, descriptions, and links

(NOTE : This is a single test , with all the required assertions )

The assertions included in this are :

  • number of features rendered is equal to features array
  • feature content is what it is required to be displayed
  • appropriate feature links are present of not
    image
    image

Related issue(s)
fixes #1762

@netlify
Copy link

netlify bot commented Jun 8, 2023

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit a06a25d
🔍 Latest deploy log https://app.netlify.com/sites/asyncapi-website/deploys/648d96f9b1b8f900078f30a4
😎 Deploy Preview https://deploy-preview-1763--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 settings.

@github-actions
Copy link

github-actions bot commented Jun 8, 2023

⚡️ Lighthouse report for the changes in this PR:

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

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

@imabp
Copy link
Member

imabp commented Jun 13, 2023

Resolve the conflicts before merging @reachaadrika

@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
Copy link
Member

@akshatnema akshatnema left a comment

Choose a reason for hiding this comment

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

Hey @reachaadrika, the tests for DocCards are failing. Kindly take the updated data.

image

components/features/index.jsx Outdated Show resolved Hide resolved
Comment on lines 10 to 46
const cards = [
{
title: 'Concepts',
description: 'Our Concepts section defines the concepts of AsyncAPI features and capabilities.',
link: '/docs/concepts',
className: 'bg-secondary-200',
Icon: IconGettingStarted,
},
{
title: 'Tutorials',
description: 'Our Tutorials section teaches beginner processes with AsyncAPI, guiding you from Point A to Point B.',
link: '/docs/tutorials',
className: 'bg-pink-100',
Icon: IconTutorials,
},
{
title: 'Tools',
description: 'Our Tools section documents the AsyncAPI tools ecosystem.',
link: '/docs/tools',
className: 'bg-green-200',
Icon: IconUseCases,
},
{
title: 'Guides',
description: "Our Guides section teaches AsyncAPI's capabilities at a high level.",
link: '/docs/guides',
className: 'bg-primary-200',
Icon: IconGuide,
},
{
title: 'Reference',
description: 'Our Reference section documents the AsyncAPI specification.',
link: '/docs/reference',
className: 'bg-yellow-200',
Icon: IconSpec,
}
];
Copy link
Member

Choose a reason for hiding this comment

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

Please use data buckets here as we use it in DocCards.js. This will maintain consistency among the codebase and we need not to update the things at 2 places.

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 , I have resolved the failing test also took the updated data from buckets file
image

Comment on lines 4 to 53
const features = [
{
name: "Specification",
description:
"Allows you to define the interfaces of asynchronous APIs and is protocol agnostic.",
links: [{ label: "Documentation", href: "docs/specifications/latest", id:'whyasyncapi-spec-documentation-link' }],
},
{
name: "Document APIs",
description:
"Use our tools to generate documentation at the build level, on a server, and on a client.",
links: [
{
label: "HTML Template",
href: "https://github.com/asyncapi/html-template",
id:'whyasyncapi-apis-htmltemplate-link'
},
{
label: "React Component",
href: "https://github.com/asyncapi/asyncapi-react/",
id:'whyasyncapi-apis-reactcomponents-link'
},
],
},
{
name: "Code Generation",
description:
"Generate documentation, Code (TypeScript, Java, C#, etc), and more out of your AsyncAPI files.",
links: [{ label: "Generator", href: "tools/generator", id:'whyasyncapi-generation-generator-link' }, { label: "Modelina", href: "tools/modelina", id:'whyasyncapi-generation-modelina-link' }],
},
{
name: "Community",
description: "We're a community of great people who are passionate about AsyncAPI and event-driven architectures.",
links: [
{ label: "Join our Slack", href: "https://asyncapi.com/slack-invite", id:'whyasyncapi-community-slack-link' },
],
},
{
name: "Open Governance",
description:
"Our Open-Source project is part of Linux Foundation and works under an Open Governance model.",
links: [{ label: "Read more about Open Governance", href: "blog/governance-motivation", id:'whyasyncapi-governance-more-link' }, { label: "TSC Members", href: "community/tsc", id:'whyasyncapi-governance-tsc-link' }],
},
{
name: "And much more...",
description:
"We have many different tools and welcome you to explore our ideas and propose new ideas to AsyncAPI.",
links: [{ label: "View GitHub Discussions", href: "https://github.com/asyncapi/community/discussions", id:'whyasyncapi-muchmore-github-link' }],
},
];
Copy link
Member

Choose a reason for hiding this comment

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

Here you require slight refactoring inside the codebase. Even inside the features/index.jsx, kindly export this array into separate file in same folder and use this array in both code and test file to maintain consistency.

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 , created a different file and exported the features list

@akshatnema
Copy link
Member

/rtm

@asyncapi-bot asyncapi-bot merged commit 0e6fcab into asyncapi:master Jun 17, 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.

adding unit tests for features and docs folder
4 participants