I’m using a function to generate some kind of data, which will be used to add it to the DB.
example = function() {
const docId = FlowRouter.getParam('docId');
let data;
// process some data and return it
data = docId;
return data;
}
Collection.insert({ value: example() });
As I’m doing some testing with mocha, the function is called for the test on server and on client. The client test is passing as expecting. But on server side I’m getting the error: Error: Object [object Object] has no method 'getParam'
I think it is a problem to use the FlowRouter param on server side. So what am I doing wrong? Do I have to restrict the function to the client side? If so, how do I do that? Or do I have to implement FlowRouter in the test block in another way?