Skip to content

Commit

Permalink
test(nodebuilder/tests): add tests for SubmitWithOptions
Browse files Browse the repository at this point in the history
Introduced tests for the SubmitWithOptions method to ensure correct behavior with valid and invalid input. These tests validate the API's handling of well-formed requests and error scenarios, improving the robustness of the DA client.
  • Loading branch information
tzdybal committed Sep 19, 2024
1 parent 71bf716 commit 616465f
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions nodebuilder/tests/da_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,30 @@ func TestDaModule(t *testing.T) {
}
},
},
{
name: "SubmitWithOptions - valid",
doFn: func(t *testing.T) {
ids, err := fullClient.DA.SubmitWithOptions(ctx, daBlobs, -1, namespace, []byte(`{"KeyName": "validator"}`))
require.NoError(t, err)
require.NotEmpty(t, ids)
},
},
{
name: "SubmitWithOptions - invalid JSON",
doFn: func(t *testing.T) {
ids, err := fullClient.DA.SubmitWithOptions(ctx, daBlobs, -1, namespace, []byte("not JSON"))
require.Error(t, err)
require.Nil(t, ids)
},
},
{
name: "SubmitWithOptions - invalid key name",
doFn: func(t *testing.T) {
ids, err := fullClient.DA.SubmitWithOptions(ctx, daBlobs, -1, namespace, []byte(`{"KeyName": "invalid"}`))
require.Error(t, err)
require.Nil(t, ids)
},
},
}

for _, tt := range test {
Expand Down

0 comments on commit 616465f

Please sign in to comment.