Files
klz-cables.com/.pnpm-store/v10/files/e2/81f8fbe4a323a3a003e3e2a37f2393c7177e3ef0d37cea05626198fd025458d9ce846de887d038efec9dfa44928e596423604ad877f05c2466b116b90afe39
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

47 lines
1.7 KiB
Plaintext

import { afterEach, beforeEach, describe, expect, it, vitest } from 'vitest';
import { findMigrationDir } from './findMigrationDir';
import fs from 'fs';
import path from 'path';
const workDir = path.resolve(import.meta.dirname, '_tmp');
describe('findMigrationDir', ()=>{
beforeEach(()=>{
const cwdSpy = vitest.spyOn(process, 'cwd');
cwdSpy.mockReturnValue(workDir);
fs.mkdirSync(workDir, {
recursive: true
});
});
afterEach(()=>{
fs.rmSync(workDir, {
force: true,
recursive: true
});
});
it('should return the passed directory', ()=>{
const dir = path.resolve(workDir, 'custom_migrations');
expect(findMigrationDir(dir)).toBe(dir);
});
it('should return src/migrations because that folder exists', ()=>{
fs.mkdirSync(path.resolve(workDir, 'src/migrations'), {
recursive: true
});
expect(findMigrationDir()).toBe(path.resolve(workDir, 'src/migrations'));
});
it('should return dist/migrations because that folder exists', ()=>{
fs.mkdirSync(path.resolve(workDir, 'dist/migrations'), {
recursive: true
});
expect(findMigrationDir()).toBe(path.resolve(workDir, 'dist/migrations'));
});
it('should return src/migrations because src exists', ()=>{
fs.mkdirSync(path.resolve(workDir, 'src'), {
recursive: true
});
expect(findMigrationDir()).toBe(path.resolve(workDir, 'src/migrations'));
});
it('should return migrations because src does not exist', ()=>{
expect(findMigrationDir()).toBe(path.resolve(workDir, 'migrations'));
});
});
//# sourceMappingURL=findMigrationDir.spec.js.map