Changeset

8817:9a3066a580ad

spec/util_pubsub: Test whether someone can subscribe to a node Test fails because of missing normalize_jid
author Kim Alvefur <zash@zash.se>
date Sun, 20 May 2018 15:20:34 +0200
parents 8816:0f9d5cfa84f9
children 8818:c96c00dc424b
files spec/util_pubsub_spec.lua
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/spec/util_pubsub_spec.lua	Tue May 22 01:32:44 2018 +0200
+++ b/spec/util_pubsub_spec.lua	Sun May 20 15:20:34 2018 +0200
@@ -31,12 +31,24 @@
 
 	describe("simple publishing", function ()
 		local broadcaster = spy.new(function () end);
-		local service = pubsub.new({ broadcaster = broadcaster; });
+		local service = pubsub.new({
+			broadcaster = broadcaster;
+			capabilities = {
+				none = {
+					subscribe = true;
+					be_subscribed = true;
+				};
+			}
+		});
 
 		it("creates a node", function ()
 			assert.truthy(service:create("node", true));
 		end);
 
+		it("lets someone subscribe", function ()
+			assert.truthy(service:add_subscription("node", true, "someone"));
+		end);
+
 		it("publishes an item", function ()
 			assert.truthy(service:publish("node", true, "1", "item 1"));
 		end);