4. Replace tests/smoke.luau
luastra/state · luastra/host · app.resolve · about 15 minutesround-trip and rejection test
The test proves valid state restoration and confirms malformed data leaves the current counter unchanged.
When to use it
Replace the generated smoke test so test covers both the successful and rejected restore paths.
Focused example
--!strict
local app = require("app/main")
local State = require("luastra/state")
app.handle("counter.add", "counter/add", "")
assert(app.snapshot().count == 1, "counter action failed")
local snapshot = State.encode(1, { count = "7" })
app.handle("counter.restore", "app", snapshot)
assert(app.snapshot().count == 7, "valid count was not restored")
app.handle("counter.restore", "app", "v=1&count=invalid")
assert(app.snapshot().message == "Stored state is invalid", "invalid count was accepted")
assert(app.snapshot().count == 7, "invalid restore changed current state")
return true