diff options
| author | Jacob Richman <[email protected]> | 2025-05-20 13:02:41 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-05-20 13:02:41 -0700 |
| commit | 716f7875a2fe4cec5433f64651a7f50cce58a41e (patch) | |
| tree | b440d482e12bc7efb55a9a813a7c4f6b67e3a117 /packages/server/src/__mocks__/fs | |
| parent | 4002e980d9e02e973e19226dbc25aeec00a65cf5 (diff) | |
Support Images and PDFs (#447)
Diffstat (limited to 'packages/server/src/__mocks__/fs')
| -rw-r--r-- | packages/server/src/__mocks__/fs/promises.ts | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/packages/server/src/__mocks__/fs/promises.ts b/packages/server/src/__mocks__/fs/promises.ts new file mode 100644 index 00000000..42385911 --- /dev/null +++ b/packages/server/src/__mocks__/fs/promises.ts @@ -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; |
