calculatorBotSpec :: Spec
calculatorBotSpec =
describe "Calculator Bot" $ do
let bot = simplifyCalculatorBot calculatorBot
it "performs arithmetic" $ do
let scenario =
[mkScript|
>>>(1 + 2)
<<<1 + 2 = 3
>>>(2 * 3)
<<<2 * 3 = 6
>>>((2 * 3) + 1)
<<<2 * 3 + 1 = 7
|]
result <- runTestScript scenario $ fixBot bot mempty
result `shouldBe` scenario
I'm really happy with this API but the internal implementation of the test server could use some work:
testServer :: Monad m => Server (StateT ([i], [(i, [o])]) m) o (Maybe i)
I store the remaining inputs and the result as ([i], [(i, [o])]) in State and produce a Maybe i for the next input to indicate when we have reached the end of the script. Is State a good choice here?
We need to have a way to short circuit the annihilation step when we hit the end of the script. AFAICT this requires a special cased annihilation function. I would love it if this isn't needed.
Resolves #8
Conversational bot integration tests such as:
I'm really happy with this API but the internal implementation of the test server could use some work:
I store the remaining inputs and the result as
([i], [(i, [o])])
inState
and produce aMaybe i
for the next input to indicate when we have reached the end of the script. IsState
a good choice here?We need to have a way to short circuit the annihilation step when we hit the end of the script. AFAICT this requires a special cased
annihilation
function. I would love it if this isn't needed.