Skip to content

Commit

Permalink
Fix: test added
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky authored and m-kus committed Feb 16, 2021
1 parent 170979e commit 188b5c6
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions internal/views/michelson_storage_view_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,20 @@ func TestMichelsonStorageView_GetCode(t *testing.T) {
{
name: "test 1",
fields: fields{
Parameter: []byte(`{"prim": "unit"}`),
Code: []byte(`{"prim": "unit"}`),
ReturnType: []byte(`{"prim": "unit"}`),
Parameter: []byte(`{"prim":"unit"}`),
Code: []byte(`{"prim":"unit"}`),
ReturnType: []byte(`{"prim":"unit"}`),
},
storageType: gjson.Parse(`{"prim": "unit"}`),
want: `[{ "prim": "parameter", "args": [{"prim": "pair", "args": [{"prim": "unit"}, {"prim": "unit"}]}]}, {"prim": "storage", "args": [{"prim": "option", "args": [{"prim": "unit"}]}]}, {"prim": "code", "args": [[{"prim": "CAR"}, {"prim": "unit"}, {"prim": "SOME"}, { "prim": "NIL", "args": [{ "prim": "operation" }]}, { "prim": "PAIR" } ]]}]`,
storageType: gjson.Parse(`{"prim":"unit"}`),
want: `[{"prim":"parameter","args":[{"prim":"pair","args":[{"prim":"unit"},{"prim":"unit"}]}]},{"prim":"storage","args":[{"prim":"option","args":[{"prim":"unit"}]}]},{"prim":"code","args":[[{"prim":"CAR"},{"prim":"unit"},{"prim":"SOME"},{"prim":"NIL","args":[{"prim":"operation"}]},{"prim":"PAIR"}]]}]`,
}, {
name: "test 2: parameter is nil",
fields: fields{
Code: []byte(`{"prim":"unit"}`),
ReturnType: []byte(`{"prim":"unit"}`),
},
storageType: gjson.Parse(`{"prim":"unit"}`),
want: `[{"prim":"parameter","args":[{"prim":"unit"}]},{"prim":"storage","args":[{"prim":"option","args":[{"prim":"unit"}]}]},{"prim":"code","args":[[{"prim":"CAR"},{"prim":"unit"},{"prim":"SOME"},{"prim":"NIL","args":[{"prim":"operation"}]},{"prim":"PAIR"}]]}]`,
},
}
for _, tt := range tests {
Expand Down

0 comments on commit 188b5c6

Please sign in to comment.