Skip to content

Commit

Permalink
Resurrect test CREATE_MIGRATION_PLAN_05.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanknowles committed May 13, 2021
1 parent c730c49 commit 93a78ce
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
Expand Up @@ -208,6 +208,30 @@ spec = describe "BYRON_MIGRATIONS" $ do
(errMsg403NothingToMigrate $ sourceWallet ^. walletId)
]

it "BYRON_CREATE_MIGRATION_PLAN_05 - \
\Creating a plan is deterministic."
$ \ctx -> forM_ [fixtureRandomWallet, fixtureIcarusWallet]
$ \fixtureByronWallet -> runResourceT $ do
sourceWallet <- fixtureByronWallet ctx
targetWallet <- emptyWallet ctx
targetAddresses <- listAddresses @n ctx targetWallet
let targetAddressIds = targetAddresses <&>
(\(ApiTypes.ApiAddress addrId _ _) -> addrId)
let ep = Link.createMigrationPlan @'Byron sourceWallet
response1 <- request @(ApiWalletMigrationPlan n) ctx ep Default
(Json [json|{addresses: #{targetAddressIds}}|])
response2 <- request @(ApiWalletMigrationPlan n) ctx ep Default
(Json [json|{addresses: #{targetAddressIds}}|])
expectResponseCode HTTP.status202 response1
expectResponseCode HTTP.status202 response2
expectField (#selections) ((.> 0) . length) response1
expectField (#selections) ((.> 0) . length) response2
case (snd response1, snd response2) of
(Right plan1, Right plan2) ->
liftIO $ plan1 `shouldBe` plan2
_ ->
error "Unable to compare plans."

describe "BYRON_MIGRATE_05 - I could migrate to any valid address" $ do
forM_ [ ("Byron", emptyRandomWallet)
, ("Icarus", emptyIcarusWallet)
Expand Down
Expand Up @@ -211,6 +211,29 @@ spec = describe "SHELLEY_MIGRATIONS" $ do
(errMsg403NothingToMigrate $ sourceWallet ^. walletId)
]

it "SHELLEY_CREATE_MIGRATION_PLAN_05 - \
\Creating a plan is deterministic."
$ \ctx -> runResourceT $ do
sourceWallet <- fixtureWallet ctx
targetWallet <- emptyWallet ctx
targetAddresses <- listAddresses @n ctx targetWallet
let targetAddressIds = targetAddresses <&>
(\(ApiTypes.ApiAddress addrId _ _) -> addrId)
let ep = Link.createMigrationPlan @'Shelley sourceWallet
response1 <- request @(ApiWalletMigrationPlan n) ctx ep Default
(Json [json|{addresses: #{targetAddressIds}}|])
response2 <- request @(ApiWalletMigrationPlan n) ctx ep Default
(Json [json|{addresses: #{targetAddressIds}}|])
expectResponseCode HTTP.status202 response1
expectResponseCode HTTP.status202 response2
expectField (#selections) ((.> 0) . length) response1
expectField (#selections) ((.> 0) . length) response2
case (snd response1, snd response2) of
(Right plan1, Right plan2) ->
plan1 `shouldBe` plan2
_ ->
error "Unable to compare plans."

describe "SHELLEY_MIGRATE_01 - \
\after a migration operation successfully completes, the correct \
\amount eventually becomes available in the target wallet for arbitrary \
Expand Down

0 comments on commit 93a78ce

Please sign in to comment.