Unit testing website front end

But can I ask about how to solve the issue of testing modules spread out across different files? I feel that my code is not exactly too coupled, just that I tend to separate my code into separate functions whenever I can, and when they are too functionally different, let them sit in a file on their own.

For example, "draw.js" implements a new cat object, the cat object which I'm storing in "graphicsLibrary.js". If I were to move the cat object code into the "draw.js" itself, I would no longer have any issues with testing. However I wanted cat to be reusable, so I wrote it in a separate file.

Is the location of code also a coupling issue? Should I be more comfortable with single long JS files with multiple functions within, rather than splitting them into their own JS files?

/r/learnjavascript Thread Parent