-
-
Notifications
You must be signed in to change notification settings - Fork 632
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
feat: add unit tests for tools scripts #2011
Conversation
✅ Deploy Preview for asyncapi-website ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-2011--asyncapi-website.netlify.app/ |
// 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 = { |
There was a problem hiding this comment.
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 = { |
There was a problem hiding this comment.
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.
const testToolFile = { | ||
title: 'Test Tool', | ||
description: 'This is a test tool', | ||
links: { | ||
repoUrl: 'https://github.com/testuser/test-repo' | ||
}, | ||
filters: { | ||
hasCommercial: true | ||
} | ||
}; |
There was a problem hiding this comment.
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?
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -0,0 +1,199 @@ | |||
import { getData } from "../../../../scripts/tools/extract-tools-github"; | |||
describe('Get Data', () => { | |||
// eslint-disable-next-line cypress/no-async-tests |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
}); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
}); | |
}); | |
}); | ||
}); | ||
}); | ||
describe('getFinalTool function', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
describe('getFinalTool function', () => { | |
describe('combineTools function', () => { |
}); | ||
}); | ||
describe('getFinalTool function', () => { | ||
it('should update the toolObject with language and technology tags if they exist', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it('should update the toolObject with language and technology tags if they exist', () => { | |
it('should able to merge automatedTools and manualTools', () => { |
…rika/website into scripts_dashboard_tests
@reachaadrika Any updates on this? |
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 |
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 ❤️ |
any updates on this? @reachaadrika |
@AnimeshKumar923 We have some other plans for the tests now. Let's wait for approvals from other maintainers/TSC members regarding it. |
Description
Related issue(s)
fixes #2010