entangld 2.2.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/test/single.js DELETED
@@ -1,48 +0,0 @@
1
- const Entangld=require("../index.js");
2
- const assert=require("assert");
3
-
4
-
5
- describe("Events",()=>{
6
-
7
-
8
- // Original tests were written with globals and are thus not independent. I'm adding (JLS 2023-02-21) some "clean" scaffolding.
9
- // TODO - we should eventually rewrite tests to use these new objects.
10
- let A,B,S;
11
- beforeEach(()=>{
12
-
13
- S=new Entangld();
14
- A=new Entangld();
15
- B=new Entangld();
16
-
17
- S.attach("a",A);
18
- S.attach("b",B);
19
-
20
- A.attach("parent", S);
21
- B.attach("parent", S);
22
-
23
- S.transmit((msg, store)=>store.receive(msg, S));
24
- A.transmit((msg, store)=>store.receive(msg, A));
25
- B.transmit((msg, store)=>store.receive(msg, B));
26
-
27
- });
28
-
29
-
30
-
31
- it("Subscribe to remote event (wildcard)", (done)=>{
32
-
33
- S.subscribe("a.*.voltage",(path, val)=>{
34
-
35
- assert.strictEqual(path,"a.system.voltage");
36
- assert.strictEqual(val, 21);
37
-
38
- // Check for proper internals
39
- assert.strictEqual(S._subscriptions.length,1);
40
- assert.strictEqual(A._subscriptions.length,1);
41
- done();
42
- });
43
-
44
- A.set("system.voltage",21);
45
- });
46
-
47
-
48
- });