d0da224a2a
See https://github.com/ooni/probe/issues/2184 While there, rename `runtimex.PanicIfFalse` to `runtimex.Assert` (it was about time...)
24 lines
445 B
Go
24 lines
445 B
Go
package mocks
|
|
|
|
import (
|
|
"errors"
|
|
"testing"
|
|
|
|
"github.com/ooni/probe-cli/v3/internal/model"
|
|
)
|
|
|
|
func TestSaver(t *testing.T) {
|
|
t.Run("SaveMeasurement", func(t *testing.T) {
|
|
expected := errors.New("mocked error")
|
|
s := &Saver{
|
|
MockSaveMeasurement: func(m *model.Measurement) error {
|
|
return expected
|
|
},
|
|
}
|
|
err := s.SaveMeasurement(&model.Measurement{})
|
|
if !errors.Is(err, expected) {
|
|
t.Fatal("unexpected err", err)
|
|
}
|
|
})
|
|
}
|