mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-22 01:37:50 +00:00
Support Images and PDFs (#447)
This commit is contained in:
48
packages/server/src/__mocks__/fs/promises.ts
Normal file
48
packages/server/src/__mocks__/fs/promises.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2025 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { vi } from 'vitest';
|
||||
import * as actualFsPromises from 'node:fs/promises';
|
||||
|
||||
const readFileMock = vi.fn();
|
||||
|
||||
// Export a control object so tests can access and manipulate the mock
|
||||
export const mockControl = {
|
||||
mockReadFile: readFileMock,
|
||||
};
|
||||
|
||||
// Export all other functions from the actual fs/promises module
|
||||
export const {
|
||||
access,
|
||||
appendFile,
|
||||
chmod,
|
||||
chown,
|
||||
copyFile,
|
||||
cp,
|
||||
lchmod,
|
||||
lchown,
|
||||
link,
|
||||
lstat,
|
||||
mkdir,
|
||||
open,
|
||||
opendir,
|
||||
readdir,
|
||||
readlink,
|
||||
realpath,
|
||||
rename,
|
||||
rmdir,
|
||||
rm,
|
||||
stat,
|
||||
symlink,
|
||||
truncate,
|
||||
unlink,
|
||||
utimes,
|
||||
watch,
|
||||
writeFile,
|
||||
} = actualFsPromises;
|
||||
|
||||
// Override readFile with our mock
|
||||
export const readFile = readFileMock;
|
||||
Reference in New Issue
Block a user