Jasmine unit testing - undefined function
<p>I'm getting error message in terminal <code>Expected undefined to be greater than 18.</code> I've created a function and i'm calling the function in expect function. Do I need to pass function as a variable?</p>

<pre><code>describe("Age Test", function() {
    it("It calculates age and the return value must be greater than 18", 
    function(){
        /* Define */
        function ageCalculator(yDD,yMM,yYY) {

            // Current date
            var today = new Date();
            var cDD = today.getDate();
            var cMM = today.getMonth()+1; //January is 0!
            var cYY = today.getFullYear();

            // Difference in date
            var dDD = cDD - yDD;
            var dMM = cMM - yMM;
            var dYY = cYY - yYY;
            if (dMM &lt; 0) {
                dYY = dYY - 1;
            }

            if (dDD &lt; 0) {
                dMM = dMM - 1;
            }

            dDD = dDD - 1;

            dMM = 12 + dMM;
            dDD = 30 + dDD;

        }

        /* Run Mock */
        expect(ageCalculator(27,4,1991)).toBeGreaterThan(18);
    });
});
</code></pre>