purescript-spec-mocha/test/Main.purs

34 lines
776 B
Plaintext
Raw Normal View History

2015-07-27 20:41:57 +03:00
module Test.Main where
import Prelude
2018-06-16 16:21:01 +03:00
import Effect.Aff (delay)
import Effect (Effect)
2017-10-04 09:00:29 +03:00
import Data.Time.Duration (Milliseconds(..))
2018-06-16 16:21:01 +03:00
import Test.Spec (describe, it, pending)
import Test.Spec.Assertions (shouldEqual)
2018-06-16 16:21:01 +03:00
import Test.Spec.Mocha (runMocha)
2015-07-27 20:41:57 +03:00
2018-06-16 16:21:01 +03:00
main :: Effect Unit
main = runMocha do
2015-07-27 20:41:57 +03:00
describe "test" $
describe "nested" do
it "works" $
(1 + 1) `shouldEqual` 2
pending "is pending"
describe "test" $
describe "other" do
it "breaks" $ 1 `shouldEqual` 2
describe "async" do
it "works" $ do
2017-10-04 09:00:29 +03:00
expected <- do
delay (Milliseconds 1.0)
pure 2
(1 + 1) `shouldEqual` expected
it "and can fail" do
2017-10-04 09:00:29 +03:00
expected <- do
delay (Milliseconds 1.0)
pure 3
(1 + 1) `shouldEqual` expected