-
Notifications
You must be signed in to change notification settings - Fork 4
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
chores/212 additional ordinals tests #217
Conversation
8b23838
to
1890cfd
Compare
} | ||
|
||
// Test case 3: Invalid UTXO txid should return an error | ||
func TestVerifyUtxosEndpointWithMixedUTXOs(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aren't we checking the txId at the handler level? Why do we need to mock the unisat and ordinal service response if the request will return error at handler layer?
mockUnisat.On("FetchInscriptionsUtxosByAddress", mock.Anything, mock.Anything, mock.Anything). | ||
Return(mockUnisatResponse, nil).Once() | ||
mockUnisat.On("FetchInscriptionsUtxosByAddress", mock.Anything, mock.Anything, mock.Anything). | ||
Return([]*unisat.UnisatUTXO{}, nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the purpose here to test the unisat pagination? then it would be best to have at least 1 item returned fromt he second response.
also it would be better to replace the mock.Anything
with the actual cursor and limit value so that we ensure the pagination works
} | ||
|
||
for _, u := range response.Data { | ||
unisatUTXO, exists := unisatUTXOMap[u.TxId] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not true. Unisat does not return all utxos.
unisat only return the utxos that has ordinals for a particular address.
I.e len(response.Data) != len(unisat response).
} | ||
|
||
// Test case 5: Unisat service return error, return error | ||
func TestVerifyUtxosEndpointUnisatServiceErrorReturnError(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: could you double check if we using UTXOs
or Utxos
in the codebase. I don't remember
callCount := 0 | ||
var mockUnisatResponses [][]*unisat.UnisatUTXO | ||
mockUnisat := new(mocks.UnisatClientInterface) | ||
mockUnisat.On("FetchInscriptionsUtxosByAddress", mock.Anything, mock.Anything, mock.Anything). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure the below tests are relevant to us.
What i thought this test would be is:
- Override the config
c.config.limit
to be a much smaller number - Send a post request
- the mocked response from unisat return
c.config.limit
many item. - triggered another call, that return the remaining items. so in total, we have over c.config.limit items from unisat
- based on all the returned values from unisat, filter the post request utxos
@@ -336,3 +336,5 @@ func buildActiveStakingEvent(t *testing.T, numOfEvenet int) []*client.ActiveStak | |||
} | |||
return activeStakingEvents | |||
} | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: one more extra line
addressed in other PR |
No description provided.