Skip to content

Commit

Permalink
fix: BlockfrostSpec on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Unisay committed Mar 18, 2022
1 parent a250581 commit 652405b
Showing 1 changed file with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,9 @@ import Options.Applicative
, info
)
import Test.Hspec
( Spec
, describe
, expectationFailure
, it
, pendingWith
, shouldBe
, shouldReturn
)
( Spec, describe, expectationFailure, it, shouldBe, shouldReturn )
import Test.Utils.Platform
( isWindows )
import UnliftIO
( withSystemTempFile )
import UnliftIO.IO
Expand All @@ -38,10 +33,8 @@ import UnliftIO.IO
spec :: Spec
spec = describe "Blockfrost CLI options" $ do
it "modeOption --node-socket" $ do
-- Named pipes are used on windows
pendingWith "Fails on windows: https://github.com/input-output-hk/cardano-wallet/pull/3160#issuecomment-1071163285"
let parserInfo = info modeOption fullDesc
args = ["--node-socket", "/tmp/file"]
args = ["--node-socket", mockSocketOrPipe]
case execParserPure defaultPrefs parserInfo args of
Failure pf -> expectationFailure $ show pf
CompletionInvoked cr -> expectationFailure $ show cr
Expand All @@ -63,14 +56,15 @@ spec = describe "Blockfrost CLI options" $ do
Blockfrost.Project Testnet (T.pack projectId)

it "modeOption requires --light flag" $ do
-- Named pipes are used on windows
pendingWith "Fails on windows: https://github.com/input-output-hk/cardano-wallet/pull/3160#issuecomment-1071163285"
let parserInfo = info modeOption fullDesc
args = ["--blockfrost-token-file", "/tmp/file"]
args = ["--blockfrost-token-file", mockSocketOrPipe]
case execParserPure defaultPrefs parserInfo args of
Failure pf | (help, _code, _int) <- execFailure pf "" ->
show help `shouldBe`
"Missing: --light\n\n\
\Usage: (--node-socket FILE | \
\--light --blockfrost-token-file FILE)"
result -> expectationFailure $ show result

mockSocketOrPipe :: String
mockSocketOrPipe = if isWindows then"\\\\.\\pipe\\test" else "/tmp/pipe"

0 comments on commit 652405b

Please sign in to comment.