Using 'export' keyword solely for importing into Unit Tests

I’m using Meteor and am writing unit tests for a Collection. I’ve got Helper methods for the collection in addition to just regular JS functions.

I.e.

Collection.helpers({
    helperFn: function () {
        return 'foo';
    }
});

//And in the same file
function bar() {
    return "bar";
}

Then in my tests file I have something like

import { Collection } from '../collections'
//Use Factory or Stub to create test Document

//This then works just fine and I can assert, etc..
testDoc.helperFn

My question is with wanting to test just the regular ‘bar’ JS function. This isn’t a big deal using ES6 classes because then I can just export the whole class and call any function with an instance of it. But with Meteor I’m finding the only way I can access the function is by using the ‘export’ keyword.

So in my Collection file

export function bar ({ return bar; });

And now in my test file I’d do something like

import { bar } from '../collection'

I’d rather not add an export statement for every time I test a new function. Is there any way around this or is it not a big deal?

The only way around it would be to make the function global:

bar = function() {
  return "bar";
}

Which I doubt is what you want to do

Ah, gotcha, yeah I’ll stick to the exports. Thanks coagmano