Skip to content

Commit 78690aa

Browse files
committed
Add test to ensure the generated TypeScript file matches
1 parent 5fa32d5 commit 78690aa

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

cardano-wasm/cardano-wasm.cabal

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,26 @@ executable cardano-wasm
6161
build-depends:
6262
ghc-experimental,
6363
utf8-string,
64+
65+
test-suite cardano-wasm-test
66+
import: project-config
67+
hs-source-dirs: test
68+
main-is: cardano-wasm-test.hs
69+
type: exitcode-stdio-1.0
70+
build-depends:
71+
hedgehog,
72+
hedgehog-extras,
73+
tasty,
74+
tasty-hedgehog,
75+
76+
ghc-options:
77+
-threaded
78+
-rtsopts
79+
"-with-rtsopts=-N -T"
80+
81+
build-tool-depends:
82+
cardano-wasm:cardano-wasm,
83+
tasty-discover:tasty-discover,
84+
85+
other-modules:
86+
Test.Golden.Cardano.Wasm.TypeScript
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module Test.Golden.Cardano.Wasm.TypeScript where
2+
3+
import Hedgehog (Property)
4+
import Hedgehog.Extras (defaultExecConfig, exec)
5+
import Hedgehog.Extras qualified as H
6+
7+
hprop_cardano_wasm_typescript_declarations_match_generated :: Property
8+
hprop_cardano_wasm_typescript_declarations_match_generated =
9+
H.propertyOnce $ do
10+
result <- exec defaultExecConfig "cardano-wasm" []
11+
H.diffVsGoldenFile result "example/cardano-api.d.ts"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{-# OPTIONS_GHC -F -pgmF tasty-discover -optF --hide-successes #-}

0 commit comments

Comments
 (0)