Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ommited fields for step event (CMW-595) #64

Merged
merged 2 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sse/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ type (
EraID uint64 `json:"era_id"`
ExecutionEffect types.Effect `json:"execution_effect"`
// Todo: not sure, didn't found example to test
Operations []types.Operation `json:"operations"`
Operations *[]types.Operation `json:"operations,omitempty"`
// Todo: not sure, didn't found example to test
Transform types.TransformKey `json:"transform"`
Transform *types.TransformKey `json:"transform,omitempty"`
}
StepEvent struct {
Step StepPayload `json:"step"`
Expand Down
13 changes: 13 additions & 0 deletions tests/sse/events_parsing_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package sse

import (
"encoding/json"
"os"
"testing"

Expand Down Expand Up @@ -97,3 +98,15 @@ func Test_RawEvent_ParseAsStepEvent(t *testing.T) {
require.NoError(t, err)
assert.False(t, res.Step.ExecutionEffect.Transforms[0].Transform.IsWriteTransfer())
}

func Test_RawEvent_ParseAndMarshalStepEvent(t *testing.T) {
data, err := os.ReadFile("../data/sse/step_event.json")
require.NoError(t, err)
rawEvent := sse.RawEvent{
Data: data,
}
res, err := rawEvent.ParseAsStepEvent()
require.NoError(t, err)
_, err = json.Marshal(res)
assert.NoError(t, err)
}
Loading