testing: add TestWebAppMetadata_DecodeMsgpack

This commit is contained in:
Derrick Hammer 2024-01-18 12:10:42 -05:00
parent 01d695b175
commit cf168f8e4d
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 26 additions and 0 deletions

View File

@ -60,6 +60,32 @@ func TestWebAppMetadata_DecodeJSON(t *testing.T) {
}
}
func TestWebAppMetadata_DecodeMsgpack(t *testing.T) {
tests := []struct {
name string
wantErr bool
}{
{
name: "Decode",
wantErr: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
jsonDm := getWebappMeta()
dm := &WebAppMetadata{}
if err := msgpack.Unmarshal(readFile("webapp.bin"), dm); (err != nil) != tt.wantErr {
t.Errorf("DecodeMsgpack() error = %v, wantErr %v", err, tt.wantErr)
}
if !cmp.Equal(jsonDm, dm) {
t.Errorf("DecodeMsgpack() error = %v, wantErr %v", "msgpack does not match json", tt.wantErr)
}
})
}
}
func TestWebAppMetadata_EncodeJSON(t *testing.T) {
tests := []struct {
name string