From a347d81a7ef6b209d04a9654526f93f59392c2ee Mon Sep 17 00:00:00 2001 From: sg Date: Tue, 8 Oct 2024 10:58:34 +0100 Subject: [PATCH] add helper methods for easier testing --- pkg/utils/test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 pkg/utils/test.go diff --git a/pkg/utils/test.go b/pkg/utils/test.go new file mode 100644 index 000000000..e7ebcd7b8 --- /dev/null +++ b/pkg/utils/test.go @@ -0,0 +1,15 @@ +package utils + +import "time" + +func PointerFromFloat64(a float64) *float64 { + return &a +} + +func TimeMustParse(layout, timestamp string) time.Time { + t, err := time.Parse(layout, timestamp) + if err != nil { + panic(err) + } + return t +}