Skip to content

Commit

Permalink
fix: fixed API tests by updating RPC provider to op sepolia staging i…
Browse files Browse the repository at this point in the history
…n tests for POST request
  • Loading branch information
Yashk767 committed May 16, 2024
1 parent f64d6ed commit 41fb5fe
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions utils/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func getAPIByteArray(index int) []byte {

func TestGetDataFromAPI(t *testing.T) {
//postRequestInput := `{"type": "POST","url": "https://staging-v3.skalenodes.com/v1/staging-aware-chief-gianfar","body": {"jsonrpc": "2.0","method": "eth_chainId","params": [],"id": 0},"header": {"content-type": "application/json"}}`
sampleChainId, _ := hex.DecodeString("7b226964223a302c226a736f6e727063223a22322e30222c22726573756c74223a2230783561373963343465227d")
sampleChainId, _ := hex.DecodeString("7b226a736f6e727063223a22322e30222c22726573756c74223a223078616133376463222c226964223a307d0a")

type args struct {
urlStruct types.DataSourceURL
Expand Down Expand Up @@ -108,7 +108,7 @@ func TestGetDataFromAPI(t *testing.T) {
args: args{
urlStruct: types.DataSourceURL{
Type: "POST",
URL: "https://staging-v3.skalenodes.com/v1/staging-aware-chief-gianfar",
URL: "https://sepolia.optimism.io",
Body: map[string]interface{}{"jsonrpc": "2.0", "method": "eth_chainId", "params": nil, "id": 0},
Header: map[string]string{"content-type": "application/json"},
},
Expand All @@ -120,7 +120,7 @@ func TestGetDataFromAPI(t *testing.T) {
args: args{
urlStruct: types.DataSourceURL{
Type: "POST",
URL: "https://staging-v3.skalenodes.com/v1/staging-aware-chief-gianfar",
URL: "https://sepolia.optimism.io",
Body: map[string]interface{}{"jsonrpc": "2.0", "method": "eth_chainId", "params": nil, "id": 0},
Header: map[string]string{"auth": "${API_KEY}", "content-type": "application/json"},
},
Expand All @@ -132,7 +132,7 @@ func TestGetDataFromAPI(t *testing.T) {
args: args{
urlStruct: types.DataSourceURL{
Type: "POST",
URL: "https://staging-v3.skalenodes.com/v1/staging-aware-chief-gianfar",
URL: "https://sepolia.optimism.io",
Body: map[string]interface{}{"fail": func() {}, "jsonrpc": 1},
},
},
Expand All @@ -144,7 +144,7 @@ func TestGetDataFromAPI(t *testing.T) {
args: args{
urlStruct: types.DataSourceURL{
Type: "",
URL: "https://jsonplaceholder.typicode.com/todos/1",
URL: "https://sepolia.optimism.io",
},
},
want: nil,
Expand Down

0 comments on commit 41fb5fe

Please sign in to comment.