1
0
Fork 0
mirror of https://github.com/pomerium/pomerium.git synced 2025-05-22 05:27:13 +02:00
pomerium/internal/encoding/mock/mock_encoder_test.go
Caleb Doxsey bbed421cd8
config: remove source, remove deadcode, fix linting issues ()
* 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")
}
}