pomerium/internal/encoding/mock/mock_encoder_test.go
Caleb Doxsey bbed421cd8
config: remove source, remove deadcode, fix linting issues (#4118)
* remove source, remove deadcode, fix linting issues

* use github action for lint

* fix missing envoy
2023-04-21 17:25:11 -06:00

26 lines
507 B
Go

package mock
import (
"errors"
"testing"
)
func TestMockEncoder(t *testing.T) {
e := errors.New("err")
mc := Encoder{
MarshalResponse: []byte("MarshalResponse"),
MarshalError: e,
UnmarshalError: e,
}
s, err := mc.Marshal("test")
if !errors.Is(err, e) {
t.Error("unexpected Marshal error")
}
if string(s) != "MarshalResponse" {
t.Error("unexpected MarshalResponse error")
}
err = mc.Unmarshal([]byte("s"), "s")
if !errors.Is(err, e) {
t.Error("unexpected Unmarshal error")
}
}