-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeveloper_path_test.go
More file actions
75 lines (67 loc) · 1.78 KB
/
Copy pathdeveloper_path_test.go
File metadata and controls
75 lines (67 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package config
import (
"context"
"strings"
"testing"
"github.com/GrayCodeAI/eyrie/credentials"
)
func TestEvaluateDeveloperPath_FreshInstall(t *testing.T) {
isolateMilestoneTest(t)
credentials.SetDefaultStore(emptyCredentialStore{})
t.Cleanup(func() { credentials.SetDefaultStore(nil) })
r := EvaluateDeveloperPath(context.Background())
if r.Ready {
t.Fatal("expected not ready on fresh install")
}
if r.ChatReady {
t.Fatal("expected chat not ready without credentials")
}
if !r.SecureReady {
for _, c := range r.Checks {
if c.Section == "Security" && c.Status == PathFail {
t.Fatalf("unexpected security fail: %+v", c)
}
}
t.Fatal("expected secure ready on fresh install (no disk secrets)")
}
}
func TestFormatDeveloperPathReport_ContainsSections(t *testing.T) {
isolateMilestoneTest(t)
credentials.SetDefaultStore(emptyCredentialStore{})
t.Cleanup(func() { credentials.SetDefaultStore(nil) })
out := FormatDeveloperPathReport(context.Background())
for _, want := range []string{
"Developer path",
"Setup",
"Security",
"Sandbox",
"Ecosystem",
"Next:",
} {
if !strings.Contains(out, want) {
t.Fatalf("expected %q in report, got:\n%s", want, out)
}
}
}
func TestProviderJSONHasSecretsOnDisk_None(t *testing.T) {
isolateMilestoneTest(t)
has, _ := providerJSONHasSecretsOnDisk()
if has {
t.Fatal("expected no secrets on missing provider.json")
}
}
func TestLegacyCredentialFilesPresent_None(t *testing.T) {
isolateMilestoneTest(t)
found, paths := legacyCredentialFilesPresent()
if found || len(paths) > 0 {
t.Fatalf("expected no legacy files, got %v", paths)
}
}
func TestPathStatusGlyph(t *testing.T) {
if pathStatusGlyph(PathPass) != "✓" {
t.Fatal("pass glyph")
}
if pathStatusGlyph(PathFail) != "✗" {
t.Fatal("fail glyph")
}
}