21 lines
815 B
Go
21 lines
815 B
Go
package provider
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestStandingIsFalseOnlyForAnEndedOrPendingValue(t *testing.T) {
|
|
for raw, want := range map[string]bool{
|
|
`{"node":"a","module":"b"}`: true,
|
|
`{"node":"a","module":"b","ended":"","state":"","x":{"y":1}}`: true,
|
|
`{"node":"a","module":"b","ended":null}`: true,
|
|
`{"node":"a","module":"b","build":"b1","commit":"c","rollout":"r","since":"t","artifact":{"name":"n"}}`: true,
|
|
`{"node":"a","module":"b","ended":"2026-10-18T01:00:00Z"}`: false,
|
|
`{"node":"a","module":"b","state":"pending"}`: false,
|
|
} {
|
|
if got := Standing([]byte(raw)); got != want {
|
|
t.Errorf("%s: %v, want %v", raw, got, want)
|
|
}
|
|
}
|
|
}
|