From bee42712962c06d9f2e9b7bf18e2cb52a56c3538 Mon Sep 17 00:00:00 2001 From: Daniel Izdebski Date: Tue, 3 Oct 2023 18:49:21 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20chore(core):=20Use=20`path?= =?UTF-8?q?.join`=20in=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/test/downloadFile.test.ts | 3 ++- packages/core/test/unzipArchive.test.ts | 14 +++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/core/test/downloadFile.test.ts b/packages/core/test/downloadFile.test.ts index 679099e4c..19ce4ba3a 100644 --- a/packages/core/test/downloadFile.test.ts +++ b/packages/core/test/downloadFile.test.ts @@ -1,3 +1,4 @@ +import path from 'node:path' import axios from 'axios' import { fs, vol } from 'memfs' import { rest } from 'msw' @@ -17,7 +18,7 @@ import { downloadFile } from '../src/downloadFile' const MOCK_OUTPUT_DIR = '/tmp' const MOCK_FILE_NAME = 'duck.txt' const MOCK_FILE_CONTENT = 'Quack! 🐾' -const MOCK_FILE_PATH = `${MOCK_OUTPUT_DIR}/${MOCK_FILE_NAME}` +const MOCK_FILE_PATH = path.join(MOCK_OUTPUT_DIR, MOCK_FILE_NAME) const MOCK_URL = `https://example.com/${MOCK_FILE_NAME}` const server = setupServer( diff --git a/packages/core/test/unzipArchive.test.ts b/packages/core/test/unzipArchive.test.ts index a7b927861..cd729ff57 100644 --- a/packages/core/test/unzipArchive.test.ts +++ b/packages/core/test/unzipArchive.test.ts @@ -1,3 +1,4 @@ +import path from 'node:path' import { fs, vol } from 'memfs' import { afterAll, @@ -18,11 +19,14 @@ import { const ROOT_DIR = '/tmp' const FILE_NAME = 'duck.txt' const NESTED_FILE_NAME = 'nested-duck.txt' -const ARCHIVE_PATH = `${ROOT_DIR}/archive.zip` -const OUTPUT_PATH = `${ROOT_DIR}/archive` -const OUTPUT_NESTED_DIR_PATH = `${OUTPUT_PATH}/nested` -const FILE_OUTPUT_PATH = `${OUTPUT_PATH}/${FILE_NAME}` -const NESTED_FILE_OUTPUT_PATH = `${OUTPUT_NESTED_DIR_PATH}/${NESTED_FILE_NAME}` +const ARCHIVE_PATH = path.join(ROOT_DIR, 'archive.zip') +const OUTPUT_PATH = path.join(ROOT_DIR, 'archive') +const OUTPUT_NESTED_DIR_PATH = path.join(OUTPUT_PATH, 'nested') +const FILE_OUTPUT_PATH = path.join(OUTPUT_PATH, FILE_NAME) +const NESTED_FILE_OUTPUT_PATH = path.join( + OUTPUT_NESTED_DIR_PATH, + NESTED_FILE_NAME +) vi.mock('fs-extra', async () => { return {