From f5c729bfde4bcd659c21ce41a791f93d94477fb6 Mon Sep 17 00:00:00 2001 From: Robin Malley Date: Fri, 2 Sep 2022 23:23:19 +0000 Subject: [PATCH] Finish the unit test to check anonymous posting works. Finish up a unit test that was previously marked TODO, which tests that a story posted anonymously appears on the home page. --- spec/posting_spec.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spec/posting_spec.lua b/spec/posting_spec.lua index 25cc954..3935b58 100644 --- a/spec/posting_spec.lua +++ b/spec/posting_spec.lua @@ -1,6 +1,7 @@ _G.spy = spy local mock_env = require("spec.env_mock") local fuzzy = require("spec.fuzzgen") +require("spec.utils") describe("smr",function() setup(mock_env.setup) @@ -35,6 +36,8 @@ describe("smr",function() } index_get(get_req) assert.stub(pages_mock.index).was_called() - pending("TODO") + assertf(get_req.responsecode >= 200 and get_req.responsecode < 300, "Should give a 2XX response code, got %d", get_req.responsecode) + assert(get_req.responsecode == 200, "Error code should be 200 - OK") + assert(get_req.response:find(get_req.response,1,true), "Failed to find title in string") end) end)