manyfest 1.0.32 → 1.0.34
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/debug/Harness.js +14 -12
- package/dist/manyfest.compatible.js +53 -46
- package/dist/manyfest.compatible.min.js +1 -1
- package/dist/manyfest.compatible.min.js.map +1 -1
- package/dist/manyfest.js +53 -46
- package/dist/manyfest.min.js +1 -1
- package/dist/manyfest.min.js.map +1 -1
- package/package.json +1 -1
- package/source/Manyfest-HashTranslation.js +2 -2
- package/source/Manyfest-ObjectAddress-CheckAddressExists.js +5 -5
- package/source/Manyfest-ObjectAddress-DeleteValue.js +2 -2
- package/source/Manyfest-ObjectAddress-GetValue.js +35 -13
- package/source/Manyfest-ObjectAddress-Parser.js +6 -6
- package/source/Manyfest-ObjectAddress-SetValue.js +3 -3
- package/source/Manyfest-SchemaManipulation.js +4 -4
- package/source/Manyfest.js +16 -16
- package/test/Data-Fruits.json +694 -0
- package/test/Manyfest_Object_Populate_tests.js +4 -4
- package/test/Manyfest_Object_ReadSets_tests.js +19 -0
- package/test/Manyfest_Object_Read_tests.js +8 -45
|
@@ -12,6 +12,7 @@ var Expect = Chai.expect;
|
|
|
12
12
|
let libManyfest = require('../source/Manyfest.js');
|
|
13
13
|
|
|
14
14
|
let _SampleDataArchiveOrgFrankenberry = require('./Data-Archive-org-Frankenberry.json');
|
|
15
|
+
let _SampleDataFruits = require('./Data-Fruits.json');
|
|
15
16
|
|
|
16
17
|
suite
|
|
17
18
|
(
|
|
@@ -113,6 +114,24 @@ suite
|
|
|
113
114
|
}
|
|
114
115
|
);
|
|
115
116
|
test
|
|
117
|
+
(
|
|
118
|
+
'Arrays in sub-objects.',
|
|
119
|
+
(fTestComplete)=>
|
|
120
|
+
{
|
|
121
|
+
let _Manyfest = new libManyfest(
|
|
122
|
+
{
|
|
123
|
+
Scope:'Archive.org',
|
|
124
|
+
Descriptors: {}
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
Expect(_Manyfest.getValueAtAddress(_SampleDataFruits, 'FruityVice[3].name')).to.equal('Tomato');
|
|
128
|
+
Expect(_Manyfest.getValueAtAddress({Fruit:_SampleDataFruits}, 'Fruit.FruityVice[3].name')).to.equal('Tomato');
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
fTestComplete();
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
test
|
|
116
135
|
(
|
|
117
136
|
'Sub-objects in arrays can be parsed and the values will be pulled in magically.',
|
|
118
137
|
(fTestComplete)=>
|
|
@@ -262,61 +262,24 @@ suite
|
|
|
262
262
|
Expect(_Manyfest.getValueAtAddress(_MockObject, 'TheFunction()')).to.equal('Value is: undefined');
|
|
263
263
|
Expect(_Manyfest.getValueAtAddress(_MockObject, 'TheFunction(Name)')).to.equal('Value is: Yadda');
|
|
264
264
|
Expect(_Manyfest.getValueAtAddress(_MockObject, 'ComplexFunction(Name,Name)')).to.equal('Value is: Yadda and would output as Yadda');
|
|
265
|
+
Expect(_Manyfest.getValueAtAddress(_MockObject, 'TheFunction("Barney")')).to.equal('Value is: Barney');
|
|
266
|
+
Expect(_Manyfest.getValueAtAddress(_MockObject, 'TheFunction("0")')).to.equal('Value is: 0');
|
|
265
267
|
|
|
266
268
|
// This is stupid but works
|
|
267
269
|
Expect(_Manyfest.getValueAtAddress(_MockObject, 'ComplexFunction(Name,TheFunction(Manyfest.Descriptors["metadata.creator"].Hash))'))
|
|
268
270
|
.to.equal('Value is: Yadda and would output as Value is: Creator');
|
|
271
|
+
Expect(_Manyfest.getValueAtAddress(_MockObject, 'ComplexFunction("Jim",TheFunction("Janet"))'))
|
|
272
|
+
.to.equal('Value is: Jim and would output as Value is: Janet');
|
|
273
|
+
Expect(_Manyfest.getValueAtAddress(_MockObject, 'ComplexFunction("Jet","Janet")'))
|
|
274
|
+
.to.equal('Value is: Jet and would output as Janet');
|
|
275
|
+
Expect(_Manyfest.getValueAtAddress(_MockObject, 'ComplexFunction("Jim",TheFunction(Manyfest.Descriptors["metadata.creator"].Hash))'))
|
|
276
|
+
.to.equal('Value is: Jim and would output as Value is: Creator');
|
|
269
277
|
|
|
270
278
|
Expect(_Manyfest.getValueAtAddress(_MockObject, 'Behaviors.Increment()'))
|
|
271
279
|
.to.equal(1);
|
|
272
280
|
|
|
273
281
|
Expect(_Manyfest.getValueAtAddress(_MockObject, 'Behaviors.SillyObject().Stores[0]')).to.equal('Aberdeen');
|
|
274
282
|
|
|
275
|
-
fTestComplete();
|
|
276
|
-
}
|
|
277
|
-
);
|
|
278
|
-
test
|
|
279
|
-
(
|
|
280
|
-
'Functions with fixed and static parameters',
|
|
281
|
-
(fTestComplete)=>
|
|
282
|
-
{
|
|
283
|
-
// Create a compmlex mock object to check metadata on.
|
|
284
|
-
let _MockObject = (
|
|
285
|
-
{
|
|
286
|
-
"Name": "Yadda",
|
|
287
|
-
"ComplexFunction": (pValue, pOutput) => { return `Value is: ${pValue} and would output as ${pOutput}`; },
|
|
288
|
-
"Behaviors":
|
|
289
|
-
{
|
|
290
|
-
"Value": 0,
|
|
291
|
-
"TheFunction": (pValue) => { return `Value is: ${pValue}`; },
|
|
292
|
-
"Increment": function ()
|
|
293
|
-
{
|
|
294
|
-
this.Value++; return this.Value;
|
|
295
|
-
},
|
|
296
|
-
"SillyObject": function()
|
|
297
|
-
{
|
|
298
|
-
return { Cost: 1.00, Name: 'Beanie Baby', Stores: ['Aberdeen', 'Seattle', 'Tacoma'] }
|
|
299
|
-
},
|
|
300
|
-
"FormatOutput": function () { return `My magic value is: ${this.Value}`; }
|
|
301
|
-
},
|
|
302
|
-
"Manyfest":
|
|
303
|
-
{
|
|
304
|
-
Scope:'Function.Mock',
|
|
305
|
-
Descriptors:
|
|
306
|
-
{
|
|
307
|
-
"metadata.creator":
|
|
308
|
-
{
|
|
309
|
-
Name:'Creator',
|
|
310
|
-
Hash:'Creator'
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
},
|
|
314
|
-
"Data": _SampleDataArchiveOrgFrankenberry
|
|
315
|
-
});
|
|
316
|
-
let _Manyfest = new libManyfest(_MockObject.Manyfest);
|
|
317
|
-
|
|
318
|
-
Expect(_Manyfest.getValueAtAddress(_MockObject, 'Behaviors.TheFunction("100")')).to.equal('Value is: 100');
|
|
319
|
-
|
|
320
283
|
fTestComplete();
|
|
321
284
|
}
|
|
322
285
|
);
|