(chore)fix: test fails on Windows CI

This commit is contained in:
tanzhenxin 2026-01-20 17:55:36 +08:00
parent 4ae8584c81
commit fd6c7364e8
2 changed files with 25 additions and 7 deletions

View file

@ -6,6 +6,7 @@
import { describe, it, expect, beforeEach, vi } from 'vitest';
import * as fs from 'node:fs';
import * as path from 'node:path';
// Mock fs module
vi.mock('node:fs', () => ({
@ -172,11 +173,15 @@ describe('languageUtils', () => {
it('should create directory and write file', () => {
writeOutputLanguageFile('Chinese');
expect(fs.mkdirSync).toHaveBeenCalledWith('/mock/home/.qwen', {
const globalDir = '/mock/home/.qwen';
const expectedDir = path.join(globalDir);
const expectedFilePath = path.join(globalDir, 'output-language.md');
expect(fs.mkdirSync).toHaveBeenCalledWith(expectedDir, {
recursive: true,
});
expect(fs.writeFileSync).toHaveBeenCalledWith(
'/mock/home/.qwen/output-language.md',
expectedFilePath,
expect.any(String),
'utf-8',
);