I have this Jest test that calls an async function called getLD which is itself an async function:
test("Should generate correct lexical density", async () => {
    var ld = await getLD("John is a Smith")
    console.log(ld);
    expect(ld).toEqual('Paul');
    expect.assertions(1);
})
And this is the async function it calls:
const NonLexWord = require('../models/Word');
exports.getLD = async (sentence) => {
    const nonLexicalWords = await NonLexWord.find({});
    // console.log(nonLexicalWords);
    const words = sentence.split(" ");
    const totalNumberOfWords = words.length;
    let totalNumberOfLexicalWords = 0;
    words.forEach(word => {
        const found = nonLexicalWords.find(element => element.name === word);
        if(!found) {
            totalNumberOfLexicalWords++;
        }
    });
    return parseFloat((totalNumberOfLexicalWords / totalNumberOfWords).toFixed(2));
}
My issue is that the body of the test never runs and I receive this error:
: Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.Timeout - Async callback was not invoked within the 5000ms timeout specified by jest.setTimeout.Error:
This is the Word model:
// For non lexical words
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
// Create Schema
const WordSchema = new Schema({
    name: {
        type: String,
    }
});
module.exports = Word = mongoose.model('word', WordSchema);
Of Course I did try increasing the time threshold like this.
