Skip to content

Commit

Permalink
fix: increase coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
joanestebanr committed Nov 19, 2024
1 parent 25690e3 commit 51abdd5
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions agglayer/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,30 @@ func TestGetEpochConfigurationOkResponse(t *testing.T) {
GenesisBlock: 1,
}, *clockConfig)
}

func TestGetLatestKnownCertificateHeaderErrorResponse(t *testing.T) {
sut := NewAggLayerClient(testURL)
jSONRPCCall = func(url, method string, params ...interface{}) (rpc.Response, error) {
return rpc.Response{}, fmt.Errorf("unittest error")
}

cert, err := sut.GetLatestKnownCertificateHeader(1)

require.Nil(t, cert)
require.Error(t, err)
}

func TestGetLatestKnownCertificateHeaderResponseBadJson(t *testing.T) {
sut := NewAggLayerClient(testURL)
response := rpc.Response{
Result: []byte(`{`),
}
jSONRPCCall = func(url, method string, params ...interface{}) (rpc.Response, error) {
return response, nil
}

cert, err := sut.GetLatestKnownCertificateHeader(1)

require.Nil(t, cert)
require.Error(t, err)
}

0 comments on commit 51abdd5

Please sign in to comment.