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 tools scripts #2011

Closed

Conversation

reachaadrika
Copy link
Contributor

Description

  • The scripts in Tools folder , make sure that tools are extracted correctly from github , and are converted to their respective related JSON folders , so that they could be displayed on the UI of tools dashboard .
  • Main files , that make sure , the scripts work uniformly are :
  • extract-tools-github : This script extracts the tools data from github .
  • combine-tools : There are 2 test files :manual and automated tests , it combines these files and pushes it into json files , Also adds languages and tech if it is not found .
  • tools-object
  • build-tools

Related issue(s)
fixes #2010

@netlify
Copy link

netlify bot commented Jul 30, 2023

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 195b1ad
🔍 Latest deploy log https://app.netlify.com/sites/asyncapi-website/deploys/64f8ba63162da8000752de79
😎 Deploy Preview https://deploy-preview-2011--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 30, 2023

⚡️ Lighthouse report for the changes in this PR:

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

Lighthouse ran on https://deploy-preview-2011--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 31, 2023
// eslint-disable-next-line cypress/no-async-tests
it('fetches AsyncAPI tools from Github', async () => {
// Define the data that the API should return (stubbed response) // this is mock data from tools.schema{}
const stubbedResponse = {
Copy link
Member

Choose a reason for hiding this comment

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

stubbedResponse is not a proper mock response.

// eslint-disable-next-line cypress/no-async-tests
it('fetches and saves in tools.json ',async () => {
// Define the data that the API should return (stubbed response)
const stubbedResponse = {
Copy link
Member

Choose a reason for hiding this comment

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

Kindly correct the stubbedResponse according to the Github API response.

Comment on lines +5 to +14
const testToolFile = {
title: 'Test Tool',
description: 'This is a test tool',
links: {
repoUrl: 'https://github.com/testuser/test-repo'
},
filters: {
hasCommercial: true
}
};
Copy link
Member

Choose a reason for hiding this comment

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

Why testToolFile doesn't consists of language, category and technology fields?

Comment on lines +131 to +132


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

@@ -0,0 +1,199 @@
import { getData } from "../../../../scripts/tools/extract-tools-github";
describe('Get Data', () => {
// eslint-disable-next-line cypress/no-async-tests
Copy link
Member

Choose a reason for hiding this comment

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

Why did we add this comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cypress eslint does n't allow async and await , thus to disable eslint this was added

Copy link
Member

Choose a reason for hiding this comment

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

You can ignore the eslint warnings in the files.

}
// Call the function directly with the mocked data
convertTools(mockData).then((finalToolsObject) => {
expect(finalToolsObject).to.exist;
Copy link
Member

Choose a reason for hiding this comment

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

finalToolsObject returned from the function contains every toolsList empty right now. Kindly check for a tool added inside the toolsList for a certain category.

Comment on lines +75 to +76


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


});
});
});
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
});
});

});
});
});
describe('getFinalTool function', () => {
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
describe('getFinalTool function', () => {
describe('combineTools function', () => {

});
});
describe('getFinalTool function', () => {
it('should update the toolObject with language and technology tags if they exist', () => {
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
it('should update the toolObject with language and technology tags if they exist', () => {
it('should able to merge automatedTools and manualTools', () => {

@akshatnema
Copy link
Member

@reachaadrika Any updates on this?

@reachaadrika
Copy link
Contributor Author

Researching on this part , it requires a lot of research , maybe will come up with something by the end of this week , I was a bit busy this week

Copy link

github-actions bot commented Jan 5, 2024

This pull request has been automatically marked as stale because it has not had recent activity 😴

It will be closed in 120 days if no further activity occurs. To unstale this pull request, add a comment with detailed explanation.

There can be many reasons why some specific pull request has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this pull request forward. Connect with us through one of many communication channels we established here.

Thank you for your patience ❤️

@github-actions github-actions bot added the stale label Jan 5, 2024
@AnimeshKumar923
Copy link
Contributor

any updates on this? @reachaadrika

cc: @akshatnema @derberg @magicmatatjahu @Mayaleeeee

@github-actions github-actions bot removed the stale label Jan 6, 2024
@akshatnema
Copy link
Member

@AnimeshKumar923 We have some other plans for the tests now. Let's wait for approvals from other maintainers/TSC members regarding it.

@akshatnema akshatnema closed this Jan 13, 2024
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

write tests for tools scripts folder
3 participants