Skip to content

Commit

Permalink
Remove redundant configurability test
Browse files Browse the repository at this point in the history
  • Loading branch information
locallycompact committed Jan 17, 2024
1 parent 81ca1ca commit be48a81
Showing 1 changed file with 0 additions and 59 deletions.
59 changes: 0 additions & 59 deletions hydra-node/test/Hydra/API/ServerSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -197,65 +197,6 @@ spec = describe "ServerSpec" $
Right timedOutputs' -> do
(output <$> timedOutputs') `shouldBe` [notHistoryMessage]

it "outputs tx as json with cbor in it" $
showLogsOnFailure "ServerSpec" $ \tracer ->
withFreePort $ \port ->
withTestAPIServer port alice mockPersistence tracer $ \Server{sendOutput} -> do
tx :: SimpleTx <- generate arbitrary
generatedSnapshot :: Snapshot SimpleTx <- generate arbitrary
headParameters <- generate arbitrary

let Snapshot{headId} = generatedSnapshot
-- The three server output message types which contain transactions
let txValidMessage = TxValid{headId = headId, transaction = tx}
let sn = generatedSnapshot{confirmed = [txId tx]}
let snapShotConfirmedMessage =
SnapshotConfirmed
{ headId = headId
, snapshot = sn
, signatures = mempty
}

let postTxFailedMessage =
PostTxOnChainFailed
{ postChainTx =
CloseTx
{ headId
, headParameters
, confirmedSnapshot =
ConfirmedSnapshot
{ Hydra.Snapshot.snapshot = sn
, Hydra.Snapshot.signatures = mempty
}
}
, postTxError = NoSeedInput
}
guardForValue v expected =
guard $ v ^? key "transaction" == Just expected

-- client is able to specify they want tx output to be encoded as CBOR
withClient port "/?history=no" $ \conn -> do
sendOutput txValidMessage

waitMatch 5 conn $ \v ->
guardForValue v $ toJSON tx

sendOutput snapShotConfirmedMessage

let expectedTxIds = Aeson.Array $ fromList [toJSON (txId tx)]

waitMatch 5 conn $ \v ->
let result =
Aeson.encode v ^? key "snapshot" . key "confirmedTransactions" . nonNull
in guard $ result == Just expectedTxIds

sendOutput postTxFailedMessage

waitMatch 5 conn $ \v ->
let result =
Aeson.encode v ^? key "postChainTx" . key "confirmedSnapshot" . key "snapshot" . key "confirmedTransactions" . nonNull
in guard $ result == Just expectedTxIds

it "removes UTXO from snapshot when clients request it" $
showLogsOnFailure "ServerSpec" $ \tracer -> failAfter 5 $
withFreePort $ \port ->
Expand Down

0 comments on commit be48a81

Please sign in to comment.