I'm experimenting with Strapi and would like to create a controller verified by unit tests.
How do I setup Unit tests within Strapi?
I have written the following test
test('checks entity inside boundary',async ()=> {
ctx={};
var result = await controller.findnearby(ctx);
result = {};
expect(result).anyting();
});
however, inside my Controller I have code that accesses a global strapi object, which causes this error ReferenceError: strapi is not defined
strapi.log.info('findNearby');
strapi.log.info(ctx.request.query.lat);
strapi.log.info(ctx.request.query.long);
What is the best practice with Strapi and testing?