Test-driven development · 42 / 69
Compare table contents
YOUR TASK
Make this happen
Tables have identity as well as contents. Test helpers use deep_eq to compare nested data. Repair the function so its nested result matches the expected structure.
Read the cases in
lesson.test.lua, then choose Check solution to see what needs to change.Update
subject.luauntil every test passes. Keep the supplied tests unchanged.
Read the starter and tests
subject.lua
exports.receipt = function()
return { order = { total = 0 }, tags = { "paid" } }
end
lesson.test.lua
local t = require("test")
local subject = require("cococo.subject")
t.it("nested receipt", function()
local s = subject.load()
t.expect(s.receipt()):deep_eq({ order = { total = 24 }, tags = { "paid" } })
end)