Skip to content

Commit

Permalink
fwqfqf
Browse files Browse the repository at this point in the history
  • Loading branch information
vishvamsinh28 committed Oct 19, 2024
1 parent 0a83f54 commit 740d4d6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion scripts/build-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ const buildTools = async (automatedToolsPath, manualToolsPath, toolsPath, tagsPa

await retryWriteFile(automatedToolsPath, JSON.stringify(automatedTools, null, ' '));

await combineTools(automatedTools, require(manualToolsPath), toolsPath, tagsPath);
const manualTools = JSON.parse(fs.readFileSync(manualToolsPath, 'utf-8'));

await combineTools(automatedTools, manualTools, toolsPath, tagsPath);
} catch (err) {
throw new Error(`An error occurred while building tools: ${err.message}`);
}
Expand Down
10 changes: 7 additions & 3 deletions tests/build-tools.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const { resolve } = require('path');
const { buildTools } = require('../scripts/build-tools');
const { tagsData, manualTools, mockConvertedData, mockExtractData } = require('../tests/fixtures/buildToolsData');
const fs = require('fs');
const { beforeEach, afterEach } = require('node:test');

jest.mock('axios');
jest.mock('../scripts/tools/categorylist', () => ({
Expand Down Expand Up @@ -54,10 +53,15 @@ describe('buildTools', () => {
beforeEach(() => {
jest.clearAllMocks();

if (!fs.existsSync(testDir)) {
fs.mkdirSync(testDir, { recursive: true });
}

if (!fs.existsSync(manualToolsPath)) {
fs.writeFileSync(manualToolsPath, JSON.stringify(manualTools));
fs.writeFileSync(manualToolsPath, JSON.stringify(manualTools));
}
});
});


it('should extract, convert, combine tools, and write to file', async () => {
axios.get.mockResolvedValue({ data: mockExtractData });
Expand Down

0 comments on commit 740d4d6

Please sign in to comment.