This repository has been archived by the owner on Oct 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(BUX-222): exposing mock consts for tests (#30)
* feat(BUX-222): exposing mock consts for tests * refactor(BUX-222): name changes
- Loading branch information
1 parent
a0e339c
commit bc5174e
Showing
5 changed files
with
121 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package fixtures | ||
|
||
const ( | ||
ProviderMain = "https://mocked_arc_api_url.com/arc" | ||
ProviderSecondary = "https://secondary_mocked_arc_api_url.com/arc" | ||
MaxScriptSizePolicy = 100000000 | ||
MaxTxSigOpsCountPolicy = 4294967295 | ||
MaxTxSizePolicy = 100000000 | ||
MaxTxSizePolicySecondary = 220000000 | ||
MiningFeeBytes = 1000 | ||
SatoshisPerBytes = 1 | ||
SatoshisPerBytesSecondary = 2 | ||
Timestamp = "2023-09-05T17:03:49.537230128Z" | ||
TimestampSecondary = "2023-09-05T17:05:29.736256927Z" | ||
TxResponseStatus = 200 | ||
TxResponseTitle = "OK" | ||
TxStatus = "SEEN_ON_NETWORK" | ||
TxBlockHash = "0000000000000000019a575e0ea4d9bbe251dd24c473a0d8407935973151f282" | ||
TxBlockHashSecondary = "0000000000000000045c969f3acd5db37896aba95f91389f2d191496bf15584b" | ||
TxBlockHeight = 800182 | ||
TxBlockHeightSecondary = 799439 | ||
TxExtraInfo = "" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,65 @@ | ||
package mocks | ||
|
||
import broadcast_api "github.com/bitcoin-sv/go-broadcast-client/broadcast" | ||
|
||
const ( | ||
MockedApiUrl1 = "https://mocked_api_url.com/arc" | ||
MockedApiUrl2 = "https://second_mocked_api_url.com/arc" | ||
import ( | ||
broadcast_api "github.com/bitcoin-sv/go-broadcast-client/broadcast" | ||
"github.com/bitcoin-sv/go-broadcast-client/broadcast/broadcast-client-mock/fixtures" | ||
) | ||
|
||
var ( | ||
Policy1 = &broadcast_api.PolicyQuoteResponse{ | ||
BaseResponse: broadcast_api.BaseResponse{Miner: MockedApiUrl1}, | ||
policy1 = &broadcast_api.PolicyQuoteResponse{ | ||
BaseResponse: broadcast_api.BaseResponse{Miner: fixtures.ProviderMain}, | ||
Policy: broadcast_api.PolicyResponse{ | ||
MaxScriptSizePolicy: 100000000, | ||
MaxTxSigOpsCountPolicy: 4294967295, | ||
MaxTxSizePolicy: 100000000, | ||
MaxScriptSizePolicy: fixtures.MaxScriptSizePolicy, | ||
MaxTxSigOpsCountPolicy: fixtures.MaxTxSigOpsCountPolicy, | ||
MaxTxSizePolicy: fixtures.MaxTxSizePolicy, | ||
MiningFee: broadcast_api.MiningFeeResponse{ | ||
Bytes: 1000, | ||
Satoshis: 1, | ||
Bytes: fixtures.MiningFeeBytes, | ||
Satoshis: fixtures.SatoshisPerBytes, | ||
}, | ||
}, | ||
Timestamp: "2023-09-05T17:03:49.537230128Z", | ||
Timestamp: fixtures.Timestamp, | ||
} | ||
|
||
Policy2 = &broadcast_api.PolicyQuoteResponse{ | ||
BaseResponse: broadcast_api.BaseResponse{Miner: MockedApiUrl2}, | ||
policy2 = &broadcast_api.PolicyQuoteResponse{ | ||
BaseResponse: broadcast_api.BaseResponse{Miner: fixtures.ProviderSecondary}, | ||
Policy: broadcast_api.PolicyResponse{ | ||
MaxScriptSizePolicy: 100000000, | ||
MaxTxSigOpsCountPolicy: 4294967295, | ||
MaxTxSizePolicy: 220000000, | ||
MaxScriptSizePolicy: fixtures.MaxScriptSizePolicy, | ||
MaxTxSigOpsCountPolicy: fixtures.MaxTxSigOpsCountPolicy, | ||
MaxTxSizePolicy: fixtures.MaxTxSizePolicySecondary, | ||
MiningFee: broadcast_api.MiningFeeResponse{ | ||
Bytes: 1000, | ||
Satoshis: 2, | ||
Bytes: fixtures.MiningFeeBytes, | ||
Satoshis: fixtures.SatoshisPerBytesSecondary, | ||
}, | ||
}, | ||
Timestamp: "2023-09-05T17:05:29.736256927Z", | ||
Timestamp: fixtures.TimestampSecondary, | ||
} | ||
|
||
submittedTx = &broadcast_api.SubmittedTx{ | ||
Status: fixtures.TxResponseStatus, | ||
Title: fixtures.TxResponseTitle, | ||
TxStatus: fixtures.TxStatus, | ||
BlockHash: fixtures.TxBlockHash, | ||
BlockHeight: fixtures.TxBlockHeight, | ||
ExtraInfo: fixtures.TxExtraInfo, | ||
} | ||
|
||
SubmittedTx = &broadcast_api.SubmittedTx{ | ||
Status: 200, | ||
Title: "OK", | ||
TxStatus: "SENT_TO_NETWORK", | ||
submittedTxSecondary = &broadcast_api.SubmittedTx{ | ||
Status: fixtures.TxResponseStatus, | ||
Title: fixtures.TxResponseTitle, | ||
TxStatus: fixtures.TxStatus, | ||
BlockHash: fixtures.TxBlockHashSecondary, | ||
BlockHeight: fixtures.TxBlockHeightSecondary, | ||
ExtraInfo: fixtures.TxExtraInfo, | ||
} | ||
) | ||
|
||
func QueryTx(txID string) *broadcast_api.QueryTxResponse { | ||
func queryTx(txID string) *broadcast_api.QueryTxResponse { | ||
return &broadcast_api.QueryTxResponse{ | ||
BaseResponse: broadcast_api.BaseResponse{Miner: MockedApiUrl1}, | ||
Timestamp: "2023-09-05T17:05:29.736256927Z", | ||
BaseResponse: broadcast_api.BaseResponse{Miner: fixtures.ProviderMain}, | ||
Timestamp: fixtures.Timestamp, | ||
TxStatus: fixtures.TxStatus, | ||
BlockHash: fixtures.TxBlockHash, | ||
BlockHeight: fixtures.TxBlockHeight, | ||
TxID: txID, | ||
TxStatus: "SEEN_ON_NETWORK", | ||
} | ||
} |