spec/util_pubsub_spec.lua
branch0.11
changeset 9746 18eca6afb367
parent 9519 038446c50630
child 9820 7f84d7f77a00
--- a/spec/util_pubsub_spec.lua	Sun Dec 23 15:22:49 2018 +0100
+++ b/spec/util_pubsub_spec.lua	Sat Dec 29 21:47:51 2018 +0100
@@ -375,4 +375,34 @@
 			end);
 		end);
 	end);
+
+	describe("restoring data from nodestore", function ()
+		local nodestore = {
+			data = {
+				test = {
+					name = "test";
+					config = {};
+					affiliations = {};
+					subscribers = {
+						["someone"] = true;
+					};
+				}
+			}
+		};
+		function nodestore:users()
+			return pairs(self.data)
+		end
+		function nodestore:get(key)
+			return self.data[key];
+		end
+		local service = pubsub.new({
+			nodestore = nodestore;
+		});
+		it("subscriptions", function ()
+			local ok, ret = service:get_subscriptions(nil, true, nil)
+			assert.is_true(ok);
+			assert.same({ { node = "test", jid = "someone", subscription = true, } }, ret);
+		end);
+	end);
+
 end);