MCPcopy
hub / github.com/google/gts / createFakeReadFilep

Function createFakeReadFilep

test/test-util.ts:33–42  ·  view source on GitHub ↗

* Creates a fake promisified readFile function from a map * @param myMap contains a filepath as the key and a ConfigFile object as the * value. * The returned function has the same interface as fs.readFile

(myMap: Map<string, ConfigFile>)

Source from the content-addressed store, hash-verified

31 * The returned function has the same interface as fs.readFile
32 */
33function createFakeReadFilep(myMap: Map<string, ConfigFile>) {
34 return (configPath: string) => {
35 const configFile = myMap.get(configPath);
36 if (configFile) {
37 return Promise.resolve(JSON.stringify(configFile));
38 } else {
39 return Promise.reject(`${configPath} Not Found`);
40 }
41 };
42}
43
44function makeFakeFsExistsSync(
45 expected: PathLike[],

Callers 1

test-util.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…