(t *testing.T)
| 81 | } |
| 82 | |
| 83 | func TestScanDirectory(t *testing.T) { |
| 84 | tmpDir := t.TempDir() |
| 85 | |
| 86 | file1 := filepath.Join(tmpDir, "main.go") |
| 87 | require.NoError(t, os.WriteFile(file1, []byte("package main\n"), 0644)) |
| 88 | |
| 89 | jsonData, err := ScanDirectory(tmpDir, 3, "Test instructions", []string{}) |
| 90 | require.NoError(t, err) |
| 91 | |
| 92 | var result []any |
| 93 | err = json.Unmarshal(jsonData, &result) |
| 94 | require.NoError(t, err) |
| 95 | assert.Len(t, result, 3) |
| 96 | |
| 97 | // Check instructions |
| 98 | instr := result[2].(map[string]any) |
| 99 | assert.Equal(t, "Test instructions", instr["details"]) |
| 100 | } |
nothing calls this directly
no test coverage detected