File

spec/util_pubsub_spec.lua @ 8562:a6188f5d5bb5

spec: Trim trailing whitespace
author Kim Alvefur <zash@zash.se>
date Tue, 06 Mar 2018 06:27:20 +0100
parent 8558:5de663cef508
child 8564:fd41dc4a78e9
line wrap: on
line source

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