MCPcopy Index your code
hub / github.com/getsentry/XcodeBuildMCP / createFsFixture

Function createFsFixture

src/utils/__tests__/project-config.test.ts:25–51  ·  view source on GitHub ↗
(options?: { exists?: boolean; readFile?: string })

Source from the content-addressed store, hash-verified

23};
24
25function createFsFixture(options?: { exists?: boolean; readFile?: string }): MockFsFixture {
26 const writes: MockWrite[] = [];
27 const mkdirs: string[] = [];
28 const exists = options?.exists ?? false;
29 const readFileContent = options?.readFile;
30
31 const fs = createMockFileSystemExecutor({
32 existsSync: (targetPath) => (targetPath === configPath ? exists : false),
33 readFile: async (targetPath) => {
34 if (targetPath !== configPath) {
35 throw new Error(`Unexpected readFile path: ${targetPath}`);
36 }
37 if (readFileContent == null) {
38 throw new Error('readFile called but no readFile content was provided');
39 }
40 return readFileContent;
41 },
42 writeFile: async (targetPath, content) => {
43 writes.push({ path: targetPath, content });
44 },
45 mkdir: async (targetPath) => {
46 mkdirs.push(targetPath);
47 },
48 });
49
50 return { fs, writes, mkdirs };
51}
52
53describe('project-config', () => {
54 describe('loadProjectConfig', () => {

Callers 1

Calls 2

pushMethod · 0.80

Tested by

no test coverage detected