From 5c4c19259739cdff4ffdb897482eeeeac2918a42 Mon Sep 17 00:00:00 2001 From: Vishvamsinh Vaghela Date: Wed, 16 Oct 2024 18:59:54 +0530 Subject: [PATCH] update path --- scripts/build-tools.js | 10 +++++----- tests/build-tools.test.js | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/scripts/build-tools.js b/scripts/build-tools.js index 84965815dcc..05c9e85bcb9 100644 --- a/scripts/build-tools.js +++ b/scripts/build-tools.js @@ -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 { @@ -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); } diff --git a/tests/build-tools.test.js b/tests/build-tools.test.js index 2bc4592e8e1..c8d0a029079 100644 --- a/tests/build-tools.test.js +++ b/tests/build-tools.test.js @@ -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'); @@ -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 }); @@ -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);