Add test for txn hash in GetLogs request.

This commit is contained in:
Arijit Das 2021-07-21 14:40:38 +05:30
parent e391af6b90
commit 0950ac85dd
2 changed files with 13 additions and 4 deletions

View File

@ -21,8 +21,13 @@ type GetStorageAt struct {
}
type LogResponse struct {
Topics []common.Hash `json:"topics"`
Data hexutil.Bytes `json:"data"`
Topics []common.Hash `json:"topics"`
Data hexutil.Bytes `json:"data"`
Transaction TransactionResp `json:"transaction"`
}
type TransactionResp struct {
Hash common.Hash `json:"hash"`
}
type GetLogs struct {
@ -44,6 +49,9 @@ func (c *Client) GetLogs(ctx context.Context, hash common.Hash, address common.A
getLogs(blockHash: "%s", contract: "%s") {
data
topics
transaction {
hash
}
}
}
`, hash.String(), address.String())

View File

@ -161,8 +161,9 @@ var _ = Describe("GraphQL", func() {
expectedLogs := []graphql.LogResponse{
{
Topics: test_helpers.MockLog1.Topics,
Data: hexutil.Bytes(test_helpers.MockLog1.Data),
Topics: test_helpers.MockLog1.Topics,
Data: hexutil.Bytes(test_helpers.MockLog1.Data),
Transaction: graphql.TransactionResp{Hash: test_helpers.MockTransactions[0].Hash()},
},
}
Expect(logs).To(Equal(expectedLogs))