-
Notifications
You must be signed in to change notification settings - Fork 44
test: improve render coverage from 78.5% to 81.1% #63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -103,3 +103,32 @@ func TestDepgraphRendersExternalDepsAndSummarySection(t *testing.T) { | |||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| func TestDepgraphWrapsLongDependencyLines(t *testing.T) { | ||||||||||||||||||||||||||||||||
| project := scanner.DepsProject{ | ||||||||||||||||||||||||||||||||
| Root: t.TempDir(), | ||||||||||||||||||||||||||||||||
| Files: []scanner.FileAnalysis{ | ||||||||||||||||||||||||||||||||
| {Path: "main.go", Functions: []string{"main"}}, | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| ExternalDeps: map[string][]string{ | ||||||||||||||||||||||||||||||||
| "go": { | ||||||||||||||||||||||||||||||||
| "github.com/example/super-long-package-alpha", | ||||||||||||||||||||||||||||||||
| "github.com/example/super-long-package-beta", | ||||||||||||||||||||||||||||||||
| "github.com/example/super-long-package-gamma", | ||||||||||||||||||||||||||||||||
| "github.com/example/super-long-package-delta", | ||||||||||||||||||||||||||||||||
| "github.com/example/super-long-package-epsilon", | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| var buf bytes.Buffer | ||||||||||||||||||||||||||||||||
| Depgraph(&buf, project) | ||||||||||||||||||||||||||||||||
| output := buf.String() | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| if !strings.Contains(output, "Go:") { | ||||||||||||||||||||||||||||||||
| t.Fatalf("expected go language dependency label, got:\n%s", output) | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| if !strings.Contains(output, "super-long-package-alpha") || !strings.Contains(output, "super-long-package-epsilon") { | ||||||||||||||||||||||||||||||||
| t.Fatalf("expected long dependency names to be present, got:\n%s", output) | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
| } | |
| } | |
| // Ensure that the Go dependency section is actually wrapped across multiple lines, | |
| // not rendered as a single overly long line. | |
| lines := strings.Split(output, "\n") | |
| wrappedLines := 0 | |
| for _, line := range lines { | |
| if strings.Contains(line, "super-long-package") { | |
| wrappedLines++ | |
| } | |
| } | |
| if wrappedLines < 2 { | |
| t.Fatalf("expected Go dependencies to be wrapped across multiple lines (found %d line), got:\n%s", wrappedLines, output) | |
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -274,3 +274,79 @@ func TestSkylineMinMax(t *testing.T) { | |||||||||||
| }) | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| func TestSkylineTickCmd(t *testing.T) { | ||||||||||||
| cmd := tickCmd() | ||||||||||||
| if cmd == nil { | ||||||||||||
| t.Fatal("expected non-nil tick command") | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| msg := cmd() | ||||||||||||
| if _, ok := msg.(tickMsg); !ok { | ||||||||||||
| t.Fatalf("expected tickMsg, got %T", msg) | ||||||||||||
| } | ||||||||||||
|
Comment on lines
+283
to
+287
|
||||||||||||
| msg := cmd() | |
| if _, ok := msg.(tickMsg); !ok { | |
| t.Fatalf("expected tickMsg, got %T", msg) | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The enforced coverage floor is raised to 50.0 here, but the badge color range configuration later in this workflow still uses minColorRange: 45. If the badge is meant to reflect the enforced floor, consider updating minColorRange to 50 (or sourcing it from the same variable) to avoid showing a green-ish badge while the job would fail below 50%.