I am using ArangoDB as storage of my sample JSON license file. I have a function that contains an AQL query like this:
listLicenses: async function listLicenses() {
let result = [];
await this.useLicenseDb();
const licenseCol = await db.collection('licenseCollection');
try {
const query = {
query: "FOR doc in licenseCollection RETURN {licenseId: doc.licenseId, licenseName: doc.licenseName, clientName: doc.clientName, useCase: doc.useCase, expirationDate: doc.expirationDate, callType: doc.callType}"
};
const cursor = await db.query(query);
result = await cursor.all();
} catch (err) {
console.error(err);
return err;
}
return result;
}
This function is querying any document present in licenseCollection collection inside an ArangoDB.
What I need is to create a unit test that calls/mocks this function, without using/needing ArangoDB Client/Server. Anyone has done like this or similar to this?
Thank you!