Skip to content

Commit

Permalink
fixed unit-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nhenin committed Apr 12, 2024
1 parent 0dda88a commit 497bf06
Show file tree
Hide file tree
Showing 7 changed files with 38,278 additions and 37,267 deletions.
52 changes: 38 additions & 14 deletions marlowe-chain-sync/.golden/ChainSeekQuery/golden

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions marlowe-runtime-web/.golden/OpenApi/golden
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@
"contractId": {
"$ref": "#/components/schemas/TxOutRef"
},
"safetyErrors": {
"items": {
"$ref": "#/components/schemas/SafetyError"
},
"type": "array"
},
"transactionId": {
"$ref": "#/components/schemas/TxId"
},
Expand Down Expand Up @@ -2153,9 +2159,6 @@
"type": "object"
},
"minUTxODeposit": {
"format": "int64",
"maximum": 1.8446744073709551615e19,
"minimum": 0,
"type": "integer"
},
"roles": {
Expand Down Expand Up @@ -2245,9 +2248,6 @@
},
"recipients": {
"additionalProperties": {
"format": "int64",
"maximum": 1.8446744073709551615e19,
"minimum": 0,
"type": "integer"
},
"type": "object"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ import qualified Data.OpenApi as OpenApi
import Data.OpenApi.Schema (ToSchema (..))
import Data.Text (Text)
import Data.Traversable (for)
import Data.Word (Word64)

import GHC.Generics (Generic)
import Language.Marlowe.Runtime.Web.Adapter.URI (
uriFromJSON,
Expand Down Expand Up @@ -197,7 +197,7 @@ instance ToSchema RoleTokenConfig where
declareNamedSchema _ = do
simpleSchema <- declareSchemaRef (Proxy @Address)
metadataSchema <- declareSchemaRef (Proxy @TokenMetadata)
quantitySchema <- declareSchemaRef (Proxy @Word64)
quantitySchema <- declareSchemaRef (Proxy @Integer)
let multiSchema =
mempty
& type_ ?~ OpenApiObject
Expand Down
29 changes: 26 additions & 3 deletions marlowe-runtime-web/test/Spec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,23 @@ import Language.Marlowe.Runtime.Web.OpenAPIServer (
)
import qualified Language.Marlowe.Runtime.Web.Payout.API as Web

import GHC.Generics (Generic)
import Language.Marlowe.Analysis.Safety.Types (
SafetyError (MissingRolesCurrency),
)
import qualified Language.Marlowe.Analysis.Safety.Types as Web
import qualified Language.Marlowe.Runtime.Web.Role.API as Web
import qualified Language.Marlowe.Runtime.Web.Role.TokenFilter as Web
import qualified Language.Marlowe.Runtime.Web.Tx.API as Web
import qualified Language.Marlowe.Runtime.Web.Withdrawal.API as Web
import Servant.API
import Servant.OpenApi
import Servant.API (
Headers,
ReqBody',
Verb,
type (:<|>),
type (:>),
)
import Servant.OpenApi (validateEveryToJSONWithPatternChecker)
import Spec.Marlowe.Semantics.Arbitrary (
ValidContractStructure (unValidContractStructure),
)
Expand Down Expand Up @@ -609,7 +620,19 @@ instance Arbitrary (Web.WithdrawTxEnvelope tx) where
shrink = genericShrink

instance Arbitrary (Web.ApplyInputsTxEnvelope tx) where
arbitrary = Web.ApplyInputsTxEnvelope <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
arbitrary =
Web.ApplyInputsTxEnvelope
<$> arbitrary
<*> arbitrary
<*> arbitrary
<*> (fmap . fmap) unWebSafetyError arbitrary
shrink = genericShrink

newtype WebSafetyError = WebSafetyError {unWebSafetyError :: Web.SafetyError}
deriving (Show, Generic)

instance Arbitrary WebSafetyError where
arbitrary = pure . WebSafetyError $ MissingRolesCurrency
shrink = genericShrink

instance Arbitrary (Web.BurnRoleTokensTxEnvelope tx) where
Expand Down
Loading

0 comments on commit 497bf06

Please sign in to comment.