Comparison

spec/util_pubsub_spec.lua @ 8558:5de663cef508

util_pubsub_spec: Beginnings of tests for util.pubsub
author Kim Alvefur <zash@zash.se>
date Sat, 03 Mar 2018 20:55:46 +0100
child 8564:fd41dc4a78e9
comparison
equal deleted inserted replaced
8557:28f9b8a5d9cb 8558:5de663cef508
1 local pubsub = require "util.pubsub";
2 describe("util.pubsub", function ()
3 describe("simple node creation and deletion", function ()
4 -- Roughly a port of scansion/scripts/pubsub_createdelete.scs
5 local service = pubsub.new();
6
7 describe("#create", function ()
8 it("creates a new node", function ()
9 assert.truthy(service:create("princely_musings", true));
10 end);
11
12 it("fails to create the same node again", function ()
13 assert.falsy(service:create("princely_musings", true));
14 end);
15 end);
16
17 describe("#delete", function ()
18 it("deletes the node", function ()
19 assert.truthy(service:delete("princely_musings", true));
20 end);
21
22 it("can't delete an already deleted node", function ()
23 assert.falsy(service:delete("princely_musings", true));
24 end);
25 end);
26 end);
27 end);