Try Install Learn Blog API Packages GitHub
Pages

Test.Context

A module for writing complex tests.

Functions

assertEqual
(
a
:
a
context
:
Test.Context(a)
)
:
Test.Context(a)

Asserts the equality of the current value of the test with the given one.

test {
  with Test.Context {
    of(5)
    |> Test.assertEqual(5)
  }
}
assertOf
(
value
:
b
method
:
Function(a, b)
context
:
Test.Context(a)
)
:
Test.Context(a)
map
(
method
:
Function(a, b)
context
:
Test.Context(a)
)
:
Test.Context(b)
of
(
a
:
a
)
:
Test.Context(a)

Starts a test using the given value.

test {
  with Test.Context {
    of(5)
    |> Test.assertEqual(5)
  }
}
then
(
proc
:
Function(a, Promise(b, c))
context
:
Test.Context(a)
)
:
Test.Context(c)

Adds a transformation step to the test.

test {
  with Test.Context {
    of(5)
    |> then(\number : Number => Promise.resolve(number + 2))
    |> assertEqual(7)
  }
}
timeout
(
duration
:
Number
context
:
Test.Context(a)
)
:
Test.Context(a)

Adds a timeout to the text using the given duration (in milliseconds).