`count` files in one import ring: each imports the next, the last the first.
(count: number)
| 33 | |
| 34 | /** `count` files in one import ring: each imports the next, the last the first. */ |
| 35 | function ring(count: number): Record<string, string> { |
| 36 | const files: Record<string, string> = {}; |
| 37 | for (let i = 0; i < count; i++) { |
| 38 | const next = (i + 1) % count; |
| 39 | files[`src/f${String(i).padStart(2, '0')}.ts`] = |
| 40 | `import { f${next} } from './f${String(next).padStart(2, '0')}';\nexport function f${i}() { return f${next}(); }\n`; |
| 41 | } |
| 42 | return files; |
| 43 | } |
| 44 | |
| 45 | describe('codegraph cycles', () => { |
| 46 | let dir: string; |