-
-
Notifications
You must be signed in to change notification settings - Fork 596
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 test for combine tools script #3136
base: master
Are you sure you want to change the base?
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 undefined |
@@ -106,7 +105,7 @@ const getFinalTool = async (toolObject) => { | |||
|
|||
// Combine the automated tools and manual tools list into single JSON object file, and | |||
// lists down all the language and technology tags in one JSON file. | |||
const combineTools = async (automatedTools, manualTools) => { | |||
const combineTools = async (automatedTools, manualTools, toolsPath, tagsPath) => { |
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.
what does tagspath
signify??
JSON.stringify({ languages: languageList, technologies: technologyList }), | ||
) | ||
fs.writeFileSync(toolsPath,JSON.stringify(finalTools)); | ||
fs.writeFileSync(tagsPath,JSON.stringify({ languages: languageList, technologies: technologyList }),) | ||
} | ||
|
||
module.exports = { combineTools } |
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.
fix this linter error
tests/tools/combine-tools.test.js
Outdated
const tagsData = readJSON(tagsPath); | ||
expect(tagsData.languages).toContainEqual(expect.objectContaining({ name: 'NewLanguage' })); | ||
}); | ||
}); |
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.
fix this one also
scripts/build-tools.js
Outdated
@@ -14,7 +14,7 @@ const buildTools = async () => { | |||
resolve(__dirname, '../config', 'tools-automated.json'), | |||
JSON.stringify(automatedTools, null, ' ') | |||
); | |||
await combineTools(automatedTools, manualTools); | |||
await combineTools(automatedTools, manualTools, resolve(__dirname, '../../config', 'tools.json'), resolve(__dirname, '../../config', 'all-tags.json')); |
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.
Can we do it in a more better way, instead of passing filePath here? Try to refactor tools scripts instead of manually passing filePaths for tags file.
}); | ||
|
||
it('should combine tools and create correct JSON files', async () => { | ||
await combineTools(automatedTools, manualTools, toolsPath, tagsPath); |
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.
try to add this function call in a try/catch
block here to monitor if we are receiving any error or not.
}); | ||
|
||
|
||
it('should log validation errors to console.error', async () => { |
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.
Errors shouldn't be validated via console messages. You should formally return a error using Promise.reject
.
@@ -6,15 +6,19 @@ const manualTools = require('../config/tools-manual.json') | |||
const fs = require('fs'); | |||
const { resolve } = require('path'); | |||
|
|||
let toolsPath = resolve(__dirname, '../../config', 'tools.json') |
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.
is using let
a good option here?
…ebsite into combineToolsTest
This PR adds test for combine tools script.