Skip to content

Commit

Permalink
remove redundant tests
Browse files Browse the repository at this point in the history
  • Loading branch information
anshgoyalevil committed Oct 3, 2024
1 parent bdf13cf commit 4600250
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 32 deletions.
4 changes: 2 additions & 2 deletions scripts/build-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ const buildTools = async (automatedToolsPath, manualToolsPath, toolsPath, tagsPa
try {
let githubExtractData = await getData();
let automatedTools = await convertTools(githubExtractData);

fs.writeFileSync(
automatedToolsPath,
JSON.stringify(automatedTools, null, ' ')
);

await combineTools(automatedTools, require(manualToolsPath), toolsPath, tagsPath);
} catch (err) {
throw new Error(`An error occurred while building tools: ${err.message}`);
Expand Down
31 changes: 1 addition & 30 deletions tests/build-tools.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jest.mock('../scripts/tools/categorylist', () => ({
{ name: 'Category1', description: 'Description for Category1' },
{ name: 'Category2', description: 'Description for Category2' }
]
}));
}));

jest.mock('../scripts/tools/tags-color', () => ({
languagesColor: [
Expand Down Expand Up @@ -75,35 +75,6 @@ describe('buildTools', () => {
}
});

it('should handle convertTools error', async () => {
axios.get.mockResolvedValue({ data: { items: [{ name: '.invalid-tool' }] } });

try {
await buildTools(automatedToolsPath, manualToolsPath, toolsPath, tagsPath);
} catch (err) {
expect(err.message).toContain('Invalid .asyncapi-tool file.');
}
});

it('should handle combineTools error', async () => {
axios.get.mockResolvedValue({ data: mockExtractData });
const invalidManualTools = [
{
title: "Invalid Tool",
description: "Description for invalid tool",
links: { repoUrl: "https://github.com/invalid/tool" },
filters: { categories: ["InvalidCategory"], language: "UnknownLanguage", technology: ["UnknownTech"] }
}
];
fs.writeFileSync(manualToolsPath, JSON.stringify(invalidManualTools));

try {
await buildTools(automatedToolsPath, manualToolsPath, toolsPath, tagsPath);
} catch (err) {
expect(err.message).toContain('Invalid Invalid Tool .asyncapi-tool file.');
}
});

it('should handle file write errors', async () => {
axios.get.mockResolvedValue({ data: mockExtractData });

Expand Down

0 comments on commit 4600250

Please sign in to comment.