aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-03-03 20:55:46 +0100
committerKim Alvefur <zash@zash.se>2018-03-03 20:55:46 +0100
commit980816bca6d2f3deafb5db0669453c538415b358 (patch)
treeaff78ea9939a196360abc5b72f218d4a5915d480 /spec
parentfe112c8cd9a1967c3f4444aa5b76d4ac4ec5a067 (diff)
downloadprosody-980816bca6d2f3deafb5db0669453c538415b358.tar.gz
prosody-980816bca6d2f3deafb5db0669453c538415b358.zip
util_pubsub_spec: Beginnings of tests for util.pubsub
Diffstat (limited to 'spec')
-rw-r--r--spec/util_pubsub_spec.lua27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/util_pubsub_spec.lua b/spec/util_pubsub_spec.lua
new file mode 100644
index 00000000..82aa7396
--- /dev/null
+++ b/spec/util_pubsub_spec.lua
@@ -0,0 +1,27 @@
+local pubsub = require "util.pubsub";
+describe("util.pubsub", function ()
+ describe("simple node creation and deletion", function ()
+ -- Roughly a port of scansion/scripts/pubsub_createdelete.scs
+ local service = pubsub.new();
+
+ describe("#create", function ()
+ it("creates a new node", function ()
+ assert.truthy(service:create("princely_musings", true));
+ end);
+
+ it("fails to create the same node again", function ()
+ assert.falsy(service:create("princely_musings", true));
+ end);
+ end);
+
+ describe("#delete", function ()
+ it("deletes the node", function ()
+ assert.truthy(service:delete("princely_musings", true));
+ end);
+
+ it("can't delete an already deleted node", function ()
+ assert.falsy(service:delete("princely_musings", true));
+ end);
+ end);
+ end);
+end);