Factory.define, in application code, not in test code


#1

I was reviewing the Todos (React) example, and like how collection helpers and simple schema are included in the module where the todos collection is defined. But I don’t see the purpose or benefit of placing the Factory.define for todo in this source file. Wouldn’t that be better placed in a test file (*.tests.js) to separate that test specific code, and also keep from loading the Factory package (and faker) when running the app? Thanks.

(what first made me look in to this was reviewing the Meteor Guide on testing, and seeing a code sample that used Factory.create without Factory.define)


#2

If it’s important to keep the bundle size smaller, then I agree it would be good to split those up!


#3

cool, fair answer, thanks. I wasn’t interested in splitting hairs, just wanted to make sure I wasn’t missing some obvious purpose.


#4

Totally fair question! :thumbsup: