28 lines
842 B
Go
28 lines
842 B
Go
package main
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"mesh-delivery-checker/internal/check"
|
|
)
|
|
|
|
func TestTheToolsServedAreTheThreeReadTools(t *testing.T) {
|
|
var names []string
|
|
for _, tl := range Tools(check.Reader{}) {
|
|
names = append(names, tl.Name)
|
|
if tl.Description == "" || tl.Run == nil {
|
|
t.Errorf("%s has no description or no run", tl.Name)
|
|
}
|
|
}
|
|
want := []string{check.VerdictsReadTool, check.PullReadTool, check.KeptReadTool}
|
|
if len(names) != 3 || names[0] != want[0] || names[1] != want[1] || names[2] != want[2] {
|
|
t.Errorf("tools = %v, want %v", names, want)
|
|
}
|
|
// With nothing to read from a tool says so and changes nothing.
|
|
for _, tl := range Tools(check.Reader{}) {
|
|
if _, err := tl.Run(map[string]any{"repository": "novox/x", "number": float64(1)}); err == nil {
|
|
t.Errorf("%s answered with no state to read", tl.Name)
|
|
}
|
|
}
|
|
}
|