mirror of
https://github.com/garethgeorge/backrest.git
synced 2025-12-15 10:05:42 +00:00
24 lines
554 B
Go
24 lines
554 B
Go
package tasks
|
|
|
|
import (
|
|
"testing"
|
|
|
|
v1 "github.com/garethgeorge/backrest/gen/go/v1"
|
|
)
|
|
|
|
func TestHookVarsEventName(t *testing.T) {
|
|
// for every value of condition, check that the event name is correct
|
|
values := v1.Hook_Condition(0).Descriptor().Values()
|
|
for i := 0; i < values.Len(); i++ {
|
|
condition := v1.Hook_Condition(values.Get(i).Number())
|
|
if condition == v1.Hook_CONDITION_UNKNOWN {
|
|
continue
|
|
}
|
|
|
|
vars := HookVars{}
|
|
if vars.EventName(condition) == "unknown" {
|
|
t.Errorf("unexpected event name for condition %v", condition)
|
|
}
|
|
}
|
|
}
|