dmcg
01/24/2021, 8:21 PM// define a test with a test block
test2("addition") {
// inside tests, the fixture is `it`
it.add(2)
assertEquals(2, it.currentValue)
}
// each new test gets its own new fixture
test2("subtraction") { calculator ->
subtract(2)
assertEquals(-2, calculator.currentValue)
}
and when it is a set of things you can write
context("key turned") {
beforeEach {
controlPanel.turnKey()
}
test2("light is on") {
assertTrue(controlPanel.warningLightOn)
}
test2("launches when pressing button") {
controlPanel.pressButton()
assertFalse(beeped)
assertTrue(launched)
}
}