'use strict'; var u = require('underscore'); var assert = require('assert'); var asserts = require('../lib/node-ff-assets'); 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() {}; } it(prefix+' should return function', function() { assert.equal(true, u.isFunction(result)); }); } else if (u.isObject(nodeValue)) { checkFunctionResult(nodeValue,prefix); } } } 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'); }); });