Well, I try to write my code in layers: data access (using the SuiteScript apis to retrieve / set data), business logic, and data manipulation. I generally translate those into separate modules. It's fairly trivial to test your business logic functions if they have no direct NetSuite dependencies.