-
Notifications
You must be signed in to change notification settings - Fork 41
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
Add OrderSchema tests #1302
Add OrderSchema tests #1302
Conversation
- Adds `SwapOrderMapper` – this mapper will attempt to decode transactions that represent a `preSignature` CoW Swap order. - Successful decoding depends on multiple conditions. If any of the following conditions occurs, the transaction is mapped to a custom transaction instead (i.e.: without any decoding in place): * Transaction data is null * Order UID cannot be retrieved * Buy or Sell token info cannot be retrieved * Unsupported order statuses (statuses which are not `fulfilled`, `open`, `cancelled` or `expired`). - Adds an `orderBuilder` to support creating multiple instances of `Order` with different properties. - The decoding of CoW Swap orders is only available if `FF_SWAPS_DECODING` is enabled.
Pull Request Test Coverage Report for Build 8295780648Details
💛 - Coveralls |
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.
Can we also add test conditions for:
- Address checksumming of
sellToken
,buyToken
,receiver
,from
,owner
,onChainUser
andonchainUser.sender
- Defaulting to
null
forreceiver
,from
,quoteId
,availableBalance
,ethflowData
,onchainUser
,executedSurplusFee
andfullAppData
.
I've also noticed that there are some hexadecimal values that could use the HexSchema
in the OrderSchema
that could then be tested as well: signature
and ethflowData.refundTxHash
.
Co-authored-by: Aaron Cook <aaron@safe.global>
expect(result.success && result.data.kind).toBe('unknown'); | ||
}); | ||
|
||
it.each<keyof Order>([ |
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.
Nice type usage!
Summary
OrderSchema
.Changes
.default('unknown')
to.catch('unknown')
in theOrderSchema
as the default value would only be set if no value was provided. If an unknown value is provided we should still set the respective value asunknown
.