Skip to content

Commit

Permalink
path udpate
Browse files Browse the repository at this point in the history
  • Loading branch information
vishvamsinh28 committed Oct 16, 2024
1 parent ec62c5e commit d958b29
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions scripts/build-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { getData } = require('./tools/extract-tools-github');
const { convertTools } = require('./tools/tools-object');
const { combineTools } = require('./tools/combine-tools');
const fs = require('fs');
const { resolve } = require('path');
const path = require('path');

const buildTools = async (automatedToolsPath, manualToolsPath, toolsPath, tagsPath) => {
try {
Expand All @@ -22,10 +22,10 @@ const buildTools = async (automatedToolsPath, manualToolsPath, toolsPath, tagsPa

/* istanbul ignore next */
if (require.main === module) {
const automatedToolsPath = resolve(__dirname, '../config', 'tools-automated.json');
const manualToolsPath = resolve(__dirname, '../config', 'tools-manual.json');
const toolsPath = resolve(__dirname, '../config', 'tools.json');
const tagsPath = resolve(__dirname, '../config', 'all-tags.json');
const automatedToolsPath = path.join(__dirname, '../config', 'tools-automated.json');
const manualToolsPath = path.join(__dirname, '../config', 'tools-manual.json');
const toolsPath = path.join(__dirname, '../config', 'tools.json');
const tagsPath = path.join(__dirname, '../config', 'all-tags.json');

buildTools(automatedToolsPath, manualToolsPath, toolsPath, tagsPath);
}
Expand Down
14 changes: 7 additions & 7 deletions tests/build-tools.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const axios = require('axios');
const { resolve } = require('path');
const path = require('path');
const { buildTools } = require('../scripts/build-tools');
const { tagsData, manualTools, mockConvertedData, mockExtractData } = require('../tests/fixtures/buildToolsData');
const fs = require('fs');
Expand All @@ -24,11 +24,11 @@ jest.mock('../scripts/tools/tags-color', () => ({
}));

describe('buildTools', () => {
const testDir = resolve(__dirname, 'test_config');
const toolsPath = resolve(testDir, 'tools.json');
const tagsPath = resolve(testDir, 'all-tags.json');
const automatedToolsPath = resolve(testDir, 'tools-automated.json');
const manualToolsPath = resolve(testDir, 'tools-manual.json');
const testDir = path.join(__dirname, 'test_config');
const toolsPath = path.join(testDir, 'tools.json');
const tagsPath = path.join(testDir, 'all-tags.json');
const automatedToolsPath = path.join(testDir, 'tools-automated.json');
const manualToolsPath = path.join(testDir, 'tools-manual.json');

beforeAll(() => {
fs.mkdirSync(testDir, { recursive: true });
Expand Down Expand Up @@ -78,7 +78,7 @@ describe('buildTools', () => {
it('should handle file write errors', async () => {
axios.get.mockResolvedValue({ data: mockExtractData });

const invalidPath = '/invalid_dir/tools.json';
const invalidPath = path.join('/invalid_dir', 'tools.json');

try {
await buildTools(invalidPath, manualToolsPath, toolsPath, tagsPath);
Expand Down

0 comments on commit d958b29

Please sign in to comment.