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 tests for lib folder #1961

Merged
merged 11 commits into from
Jul 18, 2023
Merged

Conversation

reachaadrika
Copy link
Contributor

Description

  • Lib folder , has 2 files , majorly api.js and staticHelpers.js , these files have utility functions that are used all over the codebase in variety of components .

- Api.js :

  • This has 3 functions namely getAllPosts() , getPostBySlug() , getDocBySlug() .
  • getAllPosts() : This function returns all the posts from post.json file , ie blogs , docs , etc .
  • getPostBySlug() : This function checks for the post type and matches it with slug .
  • getDocBySlug() : This function is used to retrieve a specific document by its slug. It takes two parameters: structuredPosts, which is an array of structured posts, and slug, which is the unique identifier for the document. It searches through the structuredPosts array and returns the first document that matches the given slug and is not a section.

-StaticHelpers
-getEvents : returns events with sorted dates

Introduced checks and tests using cypress

Related issue(s)
fixes #1960

@netlify
Copy link

netlify bot commented Jul 17, 2023

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit c6d73dd
🔍 Latest deploy log https://app.netlify.com/sites/asyncapi-website/deploys/64b5a915a1dffc00076d5123
😎 Deploy Preview https://deploy-preview-1961--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 lib folder feat: add tests for lib folder Jul 17, 2023
@netlify
Copy link

netlify bot commented Jul 17, 2023

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit eb01592
🔍 Latest deploy log https://app.netlify.com/sites/asyncapi-website/deploys/64b6d41277dd99000809692d
😎 Deploy Preview https://deploy-preview-1961--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 17, 2023

⚡️ Lighthouse report for the changes in this PR:

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

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

Comment on lines 29 to 33
const structuredPosts = [
{ slug: 'doc1', isSection: false },
{ slug: 'doc2', isSection: false },
{ slug: 'doc3', isSection: false }
];
Copy link
Member

Choose a reason for hiding this comment

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

Use posts['docs'] for the structured posts and test the function same as above.

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

cypress/test/lib/staticHelpers.cy.js Outdated Show resolved Hide resolved
@akshatnema
Copy link
Member

/rtm

@asyncapi-bot asyncapi-bot merged commit 039930a into asyncapi:master Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

adding unit tests for lib folder
3 participants