forked from p53841790/wheat-cache
test(aof): add codec test
This commit is contained in:
parent
787003d95a
commit
ce888a1d0e
|
@ -0,0 +1,21 @@
|
|||
package persisted
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"gitee.com/timedb/wheatCache/pkg/proto"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func Test_codec_Encode(t *testing.T) {
|
||||
c := codec{}
|
||||
req := &proto.LIndexRequest{
|
||||
Key: proto.NewBaseKey("123"),
|
||||
Index: 11,
|
||||
}
|
||||
b, err := c.Encode("LIndex", req)
|
||||
require.NoError(t, err)
|
||||
res, err := c.Decode(b)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, req.Index, res.(*proto.LIndexRequest).Index)
|
||||
}
|
Loading…
Reference in New Issue