diff options
| author | Tommaso Sciortino <[email protected]> | 2025-05-30 18:25:47 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-05-30 18:25:47 -0700 |
| commit | 21fba832d1b4ea7af43fb887d9b2b38fcf8210d0 (patch) | |
| tree | 7200d2fac3a55c385e0a2dac34b5282c942364bc /packages/core/src/__mocks__ | |
| parent | c81148a0cc8489f657901c2cc7247c0834075e1a (diff) | |
Rename server->core (#638)
Diffstat (limited to 'packages/core/src/__mocks__')
| -rw-r--r-- | packages/core/src/__mocks__/fs/promises.ts | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/packages/core/src/__mocks__/fs/promises.ts b/packages/core/src/__mocks__/fs/promises.ts new file mode 100644 index 00000000..42385911 --- /dev/null +++ b/packages/core/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; |
