2015-02-27 02:31:44 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var u = require('underscore');
|
|
|
|
var assert = require('assert');
|
|
|
|
var asserts = require('../lib/node-ff-assets');
|
|
|
|
|
2015-06-28 15:44:01 +00:00
|
|
|
var checkResult = function(result) {
|
|
|
|
return function() {
|
|
|
|
assert.equal(true, u.isFunction(result));
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2015-02-27 02:31:44 +00:00
|
|
|
var checkFunctionResult = function(node,prefixParent) {
|
|
|
|
var nodeKeys = Object.keys(node);
|
|
|
|
for (var i = 0; i < nodeKeys.length; i++) {
|
|
|
|
var nodeKey = nodeKeys[i];
|
|
|
|
var nodeValue = node[nodeKey];
|
|
|
|
var prefix = prefixParent + '.'+nodeKey;
|
|
|
|
if (u.isFunction(nodeValue)) {
|
|
|
|
var result = null;
|
|
|
|
try {
|
|
|
|
result = nodeValue();
|
|
|
|
} catch (err) {
|
|
|
|
result = function() {};
|
|
|
|
}
|
2015-06-28 15:44:01 +00:00
|
|
|
it(prefix+' should return function', checkResult(result));
|
2015-02-27 02:31:44 +00:00
|
|
|
|
|
|
|
} else if (u.isObject(nodeValue)) {
|
|
|
|
checkFunctionResult(nodeValue,prefix);
|
|
|
|
}
|
|
|
|
}
|
2015-06-28 15:44:01 +00:00
|
|
|
};
|
2015-02-27 02:31:44 +00:00
|
|
|
|
|
|
|
describe('lib/factory.js', function() {
|
|
|
|
describe('check function paths', function() {
|
|
|
|
it('asserts.factory.assembler should not be undefined', function() {
|
|
|
|
assert.equal(false, asserts.factory.assembler === undefined);
|
|
|
|
});
|
|
|
|
it('asserts.factory.assembler.constructor should not be undefined', function() {
|
|
|
|
assert.equal(false, asserts.factory.assembler.constructor === undefined);
|
|
|
|
});
|
|
|
|
it('asserts.factory.assembler.event should not be undefined', function() {
|
|
|
|
assert.equal(false, asserts.factory.assembler.event === undefined);
|
|
|
|
});
|
|
|
|
it('asserts.factory.builder should not be undefined', function() {
|
|
|
|
assert.equal(false, asserts.factory.builder === undefined);
|
|
|
|
});
|
|
|
|
it('asserts.factory.lib should not be undefined', function() {
|
|
|
|
assert.equal(false, asserts.factory.lib === undefined);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
describe('check function results', function() {
|
|
|
|
checkFunctionResult(asserts.factory,'asserts.factory');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|