fable 3.0.50 → 3.0.51
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/.config/configstore/update-notifier-npm.json +1 -1
- package/dist/fable.compatible.js +49 -39
- package/dist/fable.compatible.min.js +10 -18
- package/dist/fable.compatible.min.js.map +1 -1
- package/dist/fable.js +23 -13
- package/dist/fable.min.js +10 -18
- package/dist/fable.min.js.map +1 -1
- package/gulpfile.js +1 -164
- package/package.json +65 -78
- package/source/Fable.js +2 -0
- package/source/services/Fable-Service-Anticipate.js +87 -0
- package/source/services/Fable-Service-DataGeneration-DefaultValues.json +55 -0
- package/source/services/Fable-Service-DataGeneration.js +66 -0
- package/source/services/Fable-Service-FilePersistence-Web.js +1 -0
- package/source/services/Fable-Service-FilePersistence.js +66 -1
- package/test/Anticipate_tests.js +91 -0
- package/test/DataGeneration_tests.js +109 -0
- package/gulpfile-config.json +0 -11
- package/gulpfile-config_compatible.json +0 -11
- package/gulpfile-config_default.json +0 -11
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for the Anticipate pattern
|
|
3
|
+
* @author Steven Velozo <steven@velozo.com>
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const libFable = require('../source/Fable.js');
|
|
7
|
+
|
|
8
|
+
const Chai = require("chai");
|
|
9
|
+
const Expect = Chai.expect;
|
|
10
|
+
|
|
11
|
+
suite
|
|
12
|
+
(
|
|
13
|
+
'Fable Anticipate',
|
|
14
|
+
() =>
|
|
15
|
+
{
|
|
16
|
+
setup(() => { });
|
|
17
|
+
|
|
18
|
+
suite
|
|
19
|
+
(
|
|
20
|
+
'Basic Asynchronous Operations',
|
|
21
|
+
function ()
|
|
22
|
+
{
|
|
23
|
+
test
|
|
24
|
+
(
|
|
25
|
+
'Setup some async calls and make sure they run',
|
|
26
|
+
function (fTestComplete)
|
|
27
|
+
{
|
|
28
|
+
let testFable = new libFable();
|
|
29
|
+
let tmpAnticipate = testFable.serviceManager.instantiateServiceProvider('Anticipate');
|
|
30
|
+
tmpAnticipate.anticipate(function (fCallback)
|
|
31
|
+
{
|
|
32
|
+
testFable.log.info('Operation First test timeout entered...');
|
|
33
|
+
setTimeout(function ()
|
|
34
|
+
{
|
|
35
|
+
testFable.log.info(`Operation First test timeout done!`);
|
|
36
|
+
fCallback();
|
|
37
|
+
}, 500);
|
|
38
|
+
});
|
|
39
|
+
tmpAnticipate.anticipate(function (fCallback)
|
|
40
|
+
{
|
|
41
|
+
testFable.log.info('Operation Second test timeout entered...');
|
|
42
|
+
setTimeout(function ()
|
|
43
|
+
{
|
|
44
|
+
testFable.log.info(`Operation Second test timeout done!`);
|
|
45
|
+
fCallback();
|
|
46
|
+
}, 50);
|
|
47
|
+
});
|
|
48
|
+
tmpAnticipate.wait(function (pError)
|
|
49
|
+
{
|
|
50
|
+
testFable.log.info(`Wait 1 completed: ${pError}`)
|
|
51
|
+
return fTestComplete();
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
test
|
|
56
|
+
(
|
|
57
|
+
'Setup some async calls to run together and make sure they run',
|
|
58
|
+
function (fTestComplete)
|
|
59
|
+
{
|
|
60
|
+
let testFable = new libFable();
|
|
61
|
+
let tmpAnticipate = testFable.serviceManager.instantiateServiceProvider('Anticipate');
|
|
62
|
+
tmpAnticipate.maxOperations = 2;
|
|
63
|
+
tmpAnticipate.anticipate(function (fCallback)
|
|
64
|
+
{
|
|
65
|
+
testFable.log.info('Operation First test timeout entered...');
|
|
66
|
+
setTimeout(function ()
|
|
67
|
+
{
|
|
68
|
+
testFable.log.info(`Operation First test timeout done!`);
|
|
69
|
+
fCallback();
|
|
70
|
+
}, 500);
|
|
71
|
+
});
|
|
72
|
+
tmpAnticipate.anticipate(function (fCallback)
|
|
73
|
+
{
|
|
74
|
+
testFable.log.info('Operation Second test timeout entered...');
|
|
75
|
+
setTimeout(function ()
|
|
76
|
+
{
|
|
77
|
+
testFable.log.info(`Operation Second test timeout done!`);
|
|
78
|
+
fCallback();
|
|
79
|
+
}, 50);
|
|
80
|
+
});
|
|
81
|
+
tmpAnticipate.wait(function (pError)
|
|
82
|
+
{
|
|
83
|
+
testFable.log.info(`Wait 1 completed: ${pError}`)
|
|
84
|
+
return fTestComplete();
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
);
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for the Anticipate pattern
|
|
3
|
+
* @author Steven Velozo <steven@velozo.com>
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const libFable = require('../source/Fable.js');
|
|
7
|
+
|
|
8
|
+
const Chai = require("chai");
|
|
9
|
+
const Expect = Chai.expect;
|
|
10
|
+
|
|
11
|
+
suite
|
|
12
|
+
(
|
|
13
|
+
'Fable Data Generation',
|
|
14
|
+
() =>
|
|
15
|
+
{
|
|
16
|
+
setup(() => { });
|
|
17
|
+
|
|
18
|
+
suite
|
|
19
|
+
(
|
|
20
|
+
'Generate random numbers and strings',
|
|
21
|
+
function ()
|
|
22
|
+
{
|
|
23
|
+
test
|
|
24
|
+
(
|
|
25
|
+
'Just get me a random number',
|
|
26
|
+
function (fTestComplete)
|
|
27
|
+
{
|
|
28
|
+
let testFable = new libFable();
|
|
29
|
+
let tmpDataGeneration = testFable.serviceManager.instantiateServiceProvider('DataGeneration');
|
|
30
|
+
Expect(tmpDataGeneration.randomIntegerUpTo(100)).to.be.within(0, 99);
|
|
31
|
+
return fTestComplete();
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
test
|
|
35
|
+
(
|
|
36
|
+
'How about a random number string!',
|
|
37
|
+
function (fTestComplete)
|
|
38
|
+
{
|
|
39
|
+
let testFable = new libFable();
|
|
40
|
+
let tmpDataGeneration = testFable.serviceManager.instantiateServiceProvider('DataGeneration');
|
|
41
|
+
Expect(tmpDataGeneration.randomNumericString()).to.be.a('string');
|
|
42
|
+
Expect(tmpDataGeneration.randomNumericString().length).to.equal(10);
|
|
43
|
+
return fTestComplete();
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
test
|
|
47
|
+
(
|
|
48
|
+
'How about a random color?',
|
|
49
|
+
function (fTestComplete)
|
|
50
|
+
{
|
|
51
|
+
let testFable = new libFable();
|
|
52
|
+
let tmpDataGeneration = testFable.serviceManager.instantiateServiceProvider('DataGeneration');
|
|
53
|
+
testFable.log.info(`Random color: ${tmpDataGeneration.randomColor()}`);
|
|
54
|
+
Expect(tmpDataGeneration.randomColor()).to.be.a('string');
|
|
55
|
+
return fTestComplete();
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
test
|
|
59
|
+
(
|
|
60
|
+
'DayOfWeek',
|
|
61
|
+
function (fTestComplete)
|
|
62
|
+
{
|
|
63
|
+
let testFable = new libFable();
|
|
64
|
+
let tmpDataGeneration = testFable.serviceManager.instantiateServiceProvider('DataGeneration');
|
|
65
|
+
testFable.log.info(`Random Day of Week: ${tmpDataGeneration.randomDayOfWeek()}`);
|
|
66
|
+
Expect(tmpDataGeneration.randomDayOfWeek()).to.be.a('string');
|
|
67
|
+
return fTestComplete();
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
test
|
|
71
|
+
(
|
|
72
|
+
'Month',
|
|
73
|
+
function (fTestComplete)
|
|
74
|
+
{
|
|
75
|
+
let testFable = new libFable();
|
|
76
|
+
let tmpDataGeneration = testFable.serviceManager.instantiateServiceProvider('DataGeneration');
|
|
77
|
+
testFable.log.info(`Random Month: ${tmpDataGeneration.randomMonth()}`);
|
|
78
|
+
Expect(tmpDataGeneration.randomMonth()).to.be.a('string');
|
|
79
|
+
return fTestComplete();
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
test
|
|
83
|
+
(
|
|
84
|
+
'First name',
|
|
85
|
+
function (fTestComplete)
|
|
86
|
+
{
|
|
87
|
+
let testFable = new libFable();
|
|
88
|
+
let tmpDataGeneration = testFable.serviceManager.instantiateServiceProvider('DataGeneration');
|
|
89
|
+
testFable.log.info(`Random Name: ${tmpDataGeneration.randomName()}`);
|
|
90
|
+
Expect(tmpDataGeneration.randomName()).to.be.a('string');
|
|
91
|
+
return fTestComplete();
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
test
|
|
95
|
+
(
|
|
96
|
+
'Surname',
|
|
97
|
+
function (fTestComplete)
|
|
98
|
+
{
|
|
99
|
+
let testFable = new libFable();
|
|
100
|
+
let tmpDataGeneration = testFable.serviceManager.instantiateServiceProvider('DataGeneration');
|
|
101
|
+
testFable.log.info(`Random Surname: ${tmpDataGeneration.randomSurname()}`);
|
|
102
|
+
Expect(tmpDataGeneration.randomSurname()).to.be.a('string');
|
|
103
|
+
return fTestComplete();
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
);
|
package/gulpfile-config.json
DELETED