aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-09-28 18:36:00 +0200
committerKim Alvefur <zash@zash.se>2020-09-28 18:36:00 +0200
commitdc446463ab10d466f5c67cab4530156a85d4dd9f (patch)
treed2b92ec450cad15927bc8b1edcac21bc8d5f6643 /spec
parent9229c7a57188168e992145e4f3be6fd381ffe90c (diff)
downloadprosody-dc446463ab10d466f5c67cab4530156a85d4dd9f.tar.gz
prosody-dc446463ab10d466f5c67cab4530156a85d4dd9f.zip
util.error: Cover registry initialization in test
Diffstat (limited to 'spec')
-rw-r--r--spec/util_error_spec.lua20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/util_error_spec.lua b/spec/util_error_spec.lua
index bb85d303..6314d9ff 100644
--- a/spec/util_error_spec.lua
+++ b/spec/util_error_spec.lua
@@ -76,5 +76,25 @@ describe("util.error", function ()
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);