mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-04-14 19:56:23 +00:00
| .. | ||
| anonymized.coffee | ||
| api-helper.coffee | ||
| challenges.coffee | ||
| chat.coffee | ||
| coupons.coffee | ||
| groups.coffee | ||
| inAppPurchases.coffee | ||
| party.coffee | ||
| pushNotifications.coffee | ||
| README.md | ||
| score.coffee | ||
| status.coffee | ||
| subscriptions.coffee | ||
| todos.coffee | ||
API Tests
Our API tests are written in coffeescript using the Mocha testing framework.
There's a variety of ways to run the tests:
# Individually
mocha test/api/name_of_test.coffee
# The entire collection of api tests
mocha test/api
# As part of the whole test suite
npm test
Modules
Some modules are declared in the api-helper.coffee file for use in any of the api tests:
moment- time manipulationasync- run async processes, good for before blockslodash (_)- many utilitiesshared- generate uuidsexpect- making assertionsUser- look up a User in the db
Helper Methods
There are helper methods declared in the api-helper.coffee file. Some useful methods contained there:
registerNewUser(callback, main)- Theres a global user variable that gets overwritten with the new user whenever you callregisterNewUserunless you pass false in as the second argument.registerManyUsers(number, callback)- Good for testing things that require many users. The callback function returns new users as and array in the second argument.