Software /
code /
prosody
Annotate
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 |
rev | line source |
---|---|
8558
5de663cef508
util_pubsub_spec: Beginnings of tests for util.pubsub
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
1 local pubsub = require "util.pubsub"; |
5de663cef508
util_pubsub_spec: Beginnings of tests for util.pubsub
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
2 describe("util.pubsub", function () |
5de663cef508
util_pubsub_spec: Beginnings of tests for util.pubsub
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
3 describe("simple node creation and deletion", function () |
5de663cef508
util_pubsub_spec: Beginnings of tests for util.pubsub
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
4 -- Roughly a port of scansion/scripts/pubsub_createdelete.scs |
5de663cef508
util_pubsub_spec: Beginnings of tests for util.pubsub
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
5 local service = pubsub.new(); |
5de663cef508
util_pubsub_spec: Beginnings of tests for util.pubsub
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
6 |
5de663cef508
util_pubsub_spec: Beginnings of tests for util.pubsub
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
7 describe("#create", function () |
5de663cef508
util_pubsub_spec: Beginnings of tests for util.pubsub
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
8 it("creates a new node", function () |
5de663cef508
util_pubsub_spec: Beginnings of tests for util.pubsub
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
9 assert.truthy(service:create("princely_musings", true)); |
5de663cef508
util_pubsub_spec: Beginnings of tests for util.pubsub
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
10 end); |
5de663cef508
util_pubsub_spec: Beginnings of tests for util.pubsub
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
11 |
5de663cef508
util_pubsub_spec: Beginnings of tests for util.pubsub
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
12 it("fails to create the same node again", function () |
5de663cef508
util_pubsub_spec: Beginnings of tests for util.pubsub
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
13 assert.falsy(service:create("princely_musings", true)); |
5de663cef508
util_pubsub_spec: Beginnings of tests for util.pubsub
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
14 end); |
5de663cef508
util_pubsub_spec: Beginnings of tests for util.pubsub
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
15 end); |
5de663cef508
util_pubsub_spec: Beginnings of tests for util.pubsub
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
16 |
5de663cef508
util_pubsub_spec: Beginnings of tests for util.pubsub
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
17 describe("#delete", function () |
5de663cef508
util_pubsub_spec: Beginnings of tests for util.pubsub
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
18 it("deletes the node", function () |
5de663cef508
util_pubsub_spec: Beginnings of tests for util.pubsub
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
19 assert.truthy(service:delete("princely_musings", true)); |
5de663cef508
util_pubsub_spec: Beginnings of tests for util.pubsub
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
20 end); |
5de663cef508
util_pubsub_spec: Beginnings of tests for util.pubsub
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
21 |
5de663cef508
util_pubsub_spec: Beginnings of tests for util.pubsub
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
22 it("can't delete an already deleted node", function () |
5de663cef508
util_pubsub_spec: Beginnings of tests for util.pubsub
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
23 assert.falsy(service:delete("princely_musings", true)); |
5de663cef508
util_pubsub_spec: Beginnings of tests for util.pubsub
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
24 end); |
5de663cef508
util_pubsub_spec: Beginnings of tests for util.pubsub
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
25 end); |
5de663cef508
util_pubsub_spec: Beginnings of tests for util.pubsub
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
26 end); |
5de663cef508
util_pubsub_spec: Beginnings of tests for util.pubsub
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
27 end); |