mirror of
https://github.com/ivuorinen/gh-action-readme.git
synced 2026-01-26 03:04:10 +00:00
29 lines
598 B
Go
29 lines
598 B
Go
package internal
|
|
|
|
import "testing"
|
|
|
|
func TestValidateActionYML_Required(t *testing.T) {
|
|
|
|
a := &ActionYML{
|
|
Name: "",
|
|
Description: "",
|
|
Runs: map[string]any{},
|
|
}
|
|
res := ValidateActionYML(a)
|
|
if len(res.MissingFields) == 0 {
|
|
t.Error("should detect missing fields")
|
|
}
|
|
}
|
|
|
|
func TestValidateActionYML_Valid(t *testing.T) {
|
|
a := &ActionYML{
|
|
Name: "MyAction",
|
|
Description: "desc",
|
|
Runs: map[string]any{"using": "node12"},
|
|
}
|
|
res := ValidateActionYML(a)
|
|
if len(res.MissingFields) != 0 {
|
|
t.Errorf("expected no missing fields, got %v", res.MissingFields)
|
|
}
|
|
}
|