fable 3.0.37 → 3.0.39

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.
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Unit tests for Fable
3
+ *
4
+ * @license MIT
5
+ *
6
+ * @author Steven Velozo <steven@velozo.com>
7
+ */
8
+
9
+ var libFable = require('../source/Fable.js');
10
+
11
+ const libFS = require('fs');
12
+ const libReadline = require('readline');
13
+
14
+ var Chai = require("chai");
15
+ var Expect = Chai.expect;
16
+
17
+ suite
18
+ (
19
+ 'Manyfest Object Address Resolution',
20
+ function()
21
+ {
22
+ suite
23
+ (
24
+ 'Manifiesta',
25
+ function()
26
+ {
27
+ test
28
+ (
29
+ 'Basic object reading and writing',
30
+ function(fDone)
31
+ {
32
+ let testFable = new libFable();
33
+
34
+ let animalManyfest = testFable.serviceManager.instantiateServiceProvider('Manifest',
35
+ {
36
+ "Scope": "Animal",
37
+ "Descriptors":
38
+ {
39
+ "IDAnimal": { "Name":"Database ID", "Description":"The unique integer-based database identifier for an Animal record.", "DataType":"Integer" },
40
+ "Name": { "Description":"The animal's colloquial species name (e.g. Rabbit, Dog, Bear, Mongoose)." },
41
+ "Type": { "Description":"Whether or not the animal is wild, domesticated, agricultural, in a research lab or a part of a zoo.." },
42
+ "MedicalStats":
43
+ {
44
+ "Name":"Medical Statistics", "Description":"Basic medical statistics for this animal"
45
+ },
46
+ "MedicalStats.Temps.MinET": { "Name":"Minimum Environmental Temperature", "NameShort":"MinET", "Description":"Safest minimum temperature for this animal to survive in."},
47
+ "MedicalStats.Temps.MaxET": { "Name":"Maximum Environmental Temperature", "NameShort":"MaxET", "Description":"Safest maximum temperature for this animal to survive in."},
48
+ "MedicalStats.Temps.CET":
49
+ {
50
+ "Name":"Comfortable Environmental Temperature",
51
+ "NameShort":"Comf Env Temp",
52
+ "Hash":"ComfET",
53
+ "Description":"The most comfortable temperature for this animal to survive in.",
54
+ "Default": "96.8"
55
+ }
56
+ }
57
+ });
58
+
59
+ Expect(animalManyfest.getValueByHash({MedicalStats: { Temps: { CET:200 }},Name:'Froggy'}, 'ComfET')).to.equal(200);
60
+ Expect(animalManyfest.getValueByHash({MedicalStats: { Temps: { MinET:200 }},Name:'Froggy'}, 'ComfET')).to.equal('96.8');
61
+ Expect(animalManyfest.getValueByHash({MedicalStats: { Temps: { MinET:200 }},Name:'Froggy'}, 'CurrentTemperature')).to.equal(undefined);
62
+
63
+ // Now change the comfortable environmental temperature for the Froggy to be 200
64
+ let tmpRecord = {MedicalStats: { Temps: { MinET:200 }},Name:'Froggy'};
65
+ animalManyfest.setValueByHash(tmpRecord, 'ComfET', 200);
66
+ Expect(animalManyfest.getValueByHash(tmpRecord, 'ComfET')).to.equal(200);
67
+
68
+ Expect(animalManyfest.getValueAtAddress({MedicalStats: { Temps: { CET:200 }},Name:'Froggy'}, 'MedicalStats.Temps.CET')).to.equal(200);
69
+ Expect(animalManyfest.getValueAtAddress({MedicalStats: { Temps: { MinET:200 }},Name:'Froggy'}, 'MedicalStats.Temps.CET')).to.equal('96.8');
70
+ Expect(animalManyfest.getValueAtAddress({MedicalStats: { Temps: { MinET:200 }},Name:'Froggy'}, 'MedicalStats.Temps.HighET')).to.equal(undefined);
71
+
72
+
73
+ return fDone();
74
+ }
75
+ );
76
+ }
77
+ );
78
+ }
79
+ );
@@ -43,7 +43,7 @@ suite
43
43
  {
44
44
  Expect(pBody).to.be.an('object');
45
45
  Expect(pBody.hasOwnProperty('Name')).to.equal(true);
46
- Expect(pBody.Name).to.equal('J.K. Rowling');
46
+ Expect(pBody.Name).to.equal('Suzanne Collins');
47
47
  fTestComplete();
48
48
  });
49
49
  }