MCPcopy Create free account
hub / github.com/anus-dev/ANUS / testPath

Function testPath

packages/core/src/utils/memoryImportProcessor.test.ts:15–31  ·  view source on GitHub ↗
(...segments: string[])

Source from the content-addressed store, hash-verified

13
14// Helper function to create platform-agnostic test paths
15function testPath(...segments: string[]): string {
16 // Start with the first segment as is (might be an absolute path on Windows)
17 let result = segments[0];
18
19 // Join remaining segments with the platform-specific separator
20 for (let i = 1; i < segments.length; i++) {
21 if (segments[i].startsWith('/') || segments[i].startsWith('\\')) {
22 // If segment starts with a separator, remove the trailing separator from the result
23 result = path.normalize(result.replace(/[\\/]+$/, '') + segments[i]);
24 } else {
25 // Otherwise join with the platform separator
26 result = path.join(result, segments[i]);
27 }
28 }
29
30 return path.normalize(result);
31}
32
33vi.mock('fs/promises');
34const mockedFs = vi.mocked(fs);

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected