MCPcopy Create free account
hub / github.com/LegacyCodeHQ/clarity-cli / TestBuildDependencyGraph

Function TestBuildDependencyGraph

depgraph/dependency_graph_test.go:21–108  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

19}
20
21func TestBuildDependencyGraph(t *testing.T) {
22 // Create temporary directory with test files
23 tmpDir := t.TempDir()
24
25 // Create main.dart
26 mainContent := `
27 import 'dart:io';
28 import 'package:flutter/material.dart';
29 import 'models/user.dart';
30 import 'services/api.dart';
31
32 void main() {}
33 `
34 mainPath := filepath.Join(tmpDir, "main.dart")
35 err := os.WriteFile(mainPath, []byte(mainContent), 0644)
36 require.NoError(t, err)
37
38 // Create models directory and user.dart
39 modelsDir := filepath.Join(tmpDir, "models")
40 err = os.Mkdir(modelsDir, 0755)
41 require.NoError(t, err)
42
43 userContent := `
44 import '../utils/validator.dart';
45
46 class User {
47 String name;
48 }
49 `
50 userPath := filepath.Join(modelsDir, "user.dart")
51 err = os.WriteFile(userPath, []byte(userContent), 0644)
52 require.NoError(t, err)
53
54 // Create services directory and api.dart
55 servicesDir := filepath.Join(tmpDir, "services")
56 err = os.Mkdir(servicesDir, 0755)
57 require.NoError(t, err)
58
59 apiContent := `
60 import 'package:http/http.dart';
61 import '../models/user.dart';
62
63 class Api {}
64 `
65 apiPath := filepath.Join(servicesDir, "api.dart")
66 err = os.WriteFile(apiPath, []byte(apiContent), 0644)
67 require.NoError(t, err)
68
69 // Create utils directory and validator.dart
70 utilsDir := filepath.Join(tmpDir, "utils")
71 err = os.Mkdir(utilsDir, 0755)
72 require.NoError(t, err)
73
74 validatorContent := `
75 class Validator {}
76 `
77 validatorPath := filepath.Join(utilsDir, "validator.dart")
78 err = os.WriteFile(validatorPath, []byte(validatorContent), 0644)

Callers

nothing calls this directly

Calls 3

BuildDependencyGraphFunction · 0.92
FilesystemContentReaderFunction · 0.92
mustAdjacencyFunction · 0.85

Tested by

no test coverage detected