Software /
code /
prosody
Diff
spec/util_error_spec.lua @ 11097:f23cf8e2e2ff
util.error: Cover registry initialization in test
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 28 Sep 2020 18:36:00 +0200 |
parent | 11092:bd13aa89262d |
child | 11100:3aa06cdd2dc8 |
line wrap: on
line diff
--- a/spec/util_error_spec.lua Mon Sep 28 16:21:41 2020 +0100 +++ b/spec/util_error_spec.lua Mon Sep 28 18:36:00 2020 +0200 @@ -76,5 +76,25 @@ end); end) + describe("init", function() + it("basics works", function() + local reg = errors.init("test", { + broke = {type = "cancel"; condition = "internal-server-error"; text = "It broke :("}; + nope = {type = "auth"; condition = "not-authorized"; text = "Can't let you do that Dave"}; + }); + + local broke = reg.new("broke"); + assert.equal("cancel", broke.type); + assert.equal("internal-server-error", broke.condition); + assert.equal("It broke :(", broke.text); + assert.equal("test", broke.source); + + local nope = reg.new("nope"); + assert.equal("auth", nope.type); + assert.equal("not-authorized", nope.condition); + assert.equal("Can't let you do that Dave", nope.text); + end); + end); + end);