Skip to content

Commit

Permalink
♻️ chore(core): Use path.join in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
duckception committed Oct 3, 2023
1 parent 2d55c86 commit bee4271
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion packages/core/test/downloadFile.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import path from 'node:path'
import axios from 'axios'
import { fs, vol } from 'memfs'
import { rest } from 'msw'
Expand All @@ -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(
Expand Down
14 changes: 9 additions & 5 deletions packages/core/test/unzipArchive.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import path from 'node:path'
import { fs, vol } from 'memfs'
import {
afterAll,
Expand All @@ -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 {
Expand Down

0 comments on commit bee4271

Please sign in to comment.