Your function are not empty. In fact, in javascript, there are 2 ways to define a function :
function myFunction (arg1, arg2){
//Do some stuff
}
or
var myFunction = function(arg1, arg2){
//Do some stuff
}
In both cases, the function is stored in the variable called "my function" (with different scopes, though).
So basically, in javascript, a function is a value. You may draw a parallel with functional pointers in c, to understand the way it works.
Now, what mocha does, is getting the test process as a parameter of the function describe, and the test itself as a parameter of the function it (you can set initiliazing/cleaning processes with before/afer functions as well).
We can now see what the "done" function is. The done function (you can give it the name you want, done is just the most common name) is the function you should call when your test is over. It's given as a parameter of the function that defines the process you're in. Quick example :
it('should work', function(done){
//do some testing
done();
});
does the same thing as :
it('should work', function(){
//do some testing
});
But where that parameter is useful is when you're testing asynchronous functions. For example, I want to test a query in a database, which is not instant.
it("should work", function(){
dbDriver.get('key1', function(data){
assert(data == goodValue);
});
});
The previous example will not work properly, cause the db request is not instantaneous and is an asynchronous call, which mean that my test will keep running, and my assertion will happen after we left the test section. So mocha will think that everything was ok, and then will ignore my assertion afterwards.
To allow asynchronous function testing, mocha designed the done parameter, which makes the test to keep on running while the parameter function is not called, so, if I want my test to run correctly, I have to do it like this :
it("should work", function(done){
dbDriver.get('key1', function(data){
assert(data == goodValue);
done();
});
});
Now, mocha will be stuck in this test while the done function is not called. And, it will be called once the callback of the get function is called and the assertion is made.
Now, let's look at the code. First of all, your call to done is uncalled (...) for. Done is not given as a parameter of any of your callbacks, so it should be undefined, and, if that line was executed, you would simply get a syntax error.
Now, basically, what's happening in your code is that a function doesn't respond fast enough, so mocha considers that the test has timed out (default value is 2000 ms).
Basically, you should start testing adding the function one by one in your process to check which one is timing out, to then be able to reduce your problem to the timed out function only.
If you want to learn mocha, the official website of the framework is pretty good : http://mochajs.org/, and presents some good practice (like using before and after).
I hope I wasn't too long and that I could help you understanding mocha and javascript better.