In general, there is only one overarching pattern for unit testing code on the Salesforce1 platform. The essential differences between the Salesforce1 platform and other software development stacks does make unit testing is a bit different. That said, if you're familiar with unit testing in other languages, this will largely seem familiar to you. Here's the general pattern:
Each of our test methods needs to create its own test data. While this seems cumbersome and time consuming, it's the only safe way to run unit tests. Relying on existing data in your org is problematic because you cannot ensure that the data will exist in your other orgs. Assuming an account will exist in your production org just because it exists in your development sandbox is a great recipe for frustrating deployments. This often finds its way into our tests through the use of hardcoded IDs. Querying for an account where the ID is X
, for instance, not only assumes that the account...