Initial commit
This commit is contained in:
commit
66cf1fc9aa
30 changed files with 2735 additions and 0 deletions
26
checker/testhelpers_test.go
Normal file
26
checker/testhelpers_test.go
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
package checker
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
sdk "git.happydns.org/checker-sdk-go/checker"
|
||||
)
|
||||
|
||||
// staticCtx is a minimal sdk.ReportContext used by report tests.
|
||||
type staticCtx struct {
|
||||
data json.RawMessage
|
||||
}
|
||||
|
||||
func (s staticCtx) Data() json.RawMessage { return s.data }
|
||||
func (staticCtx) Related(sdk.ObservationKey) []sdk.RelatedObservation { return nil }
|
||||
func (staticCtx) States() []sdk.CheckState { return nil }
|
||||
|
||||
func jsonOf(t *testing.T, v any) []byte {
|
||||
t.Helper()
|
||||
b, err := json.Marshal(v)
|
||||
if err != nil {
|
||||
t.Fatalf("marshal: %v", err)
|
||||
}
|
||||
return b
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue