File

spec/util_pubsub_spec.lua @ 8606:b6b1f0f9b381

MUC: Use empty string if no subject provided (thanks pep+)
author Matthew Wild <mwild1@gmail.com>
date Fri, 16 Mar 2018 17:36:49 +0000
parent 8564:fd41dc4a78e9
child 8647:638ff2ad98e6
line wrap: on
line source

local pubsub;
setup(function ()
	pubsub = require "util.pubsub";
end);

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);