{"_id":"55c4a5678b45eb0d004cfb5f","parentDoc":null,"__v":4,"project":"55a92d71cf45e1390093f321","category":{"_id":"55a92d72cf45e1390093f325","version":"55a92d71cf45e1390093f324","__v":9,"pages":["55a92d73cf45e1390093f327","55bcc17916d37e2d00b8b628","55bf1ca603d092210084c067","55bf2256e2eec72d00d8c4a8","55bf265203d092210084c080","55bf2fd603d092210084c094","55c4a5678b45eb0d004cfb5f","560734f88730190d00059bf8","56103f7822db042b00bdcc3a"],"project":"55a92d71cf45e1390093f321","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-07-17T16:29:38.279Z","from_sync":false,"order":0,"slug":"getting-started","title":"Getting Started"},"user":"55a4738a68c7e20d0036d4de","version":{"_id":"55a92d71cf45e1390093f324","__v":12,"project":"55a92d71cf45e1390093f321","createdAt":"2015-07-17T16:29:37.746Z","releaseDate":"2015-07-17T16:29:37.746Z","categories":["55a92d72cf45e1390093f325","55b9aea1baf4cd2300bc56e7","55bf16593179dd1900a19521","55bf16b93179dd1900a19525","55bf16c53bbd4b17002c2369","55bf234703d092210084c07b","55bf2859ad601c2b00762c4c","55bf3217ad601c2b00762c69","55bf321b03d092210084c09d","55bf5ef78b83a5370044504e","55c345418713ec1900d1732d","55c3473057f7f32d0016ec0a"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-08-07T12:32:39.839Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":5,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Install\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"meteor add velocity:helpers\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Testing helpers\"\n}\n[/block]\nIn addition to this documentation, also look at [the specs](https://github.com/meteor-velocity/velocity-helpers/tree/master/specs) for them.\nThis will give you example usages. All testing helpers are methods on the `VelocityHelpers` global.\n\n* **getElement(selector: string, context: element)**\nLike `$(selector, context)` but it throws an error when the element has not been found.\n\n* **getMethod(methodName: string)**\nReturns the requested Meteor method function.\n\n* **getMethods()**\nReturns a hash of all Meteor methods.\n\n* **spyOnMethod(methodName: string) (Jasmine only)**\nGives you a [spy](http://jasmine.github.io/2.3/introduction.html#section-Spies) for a Meteor method.\n\n* **stubMethod(methodName: string, error: Object, result: Object) (Jasmine only)**\nReplaces the real Meteor method call with a stub that immediately calls the callback with the `error` and `result` objects you pass to this method.\n\n* **waitFor(check: function, successCallback: function) (Jasmine only)**\nWaits until the check function returns true and then calls the success callback.\n\nhttps://github.com/meteor-velocity/velocity-helpers\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Expose helpers globally\"\n}\n[/block]\nBy default all testing helpers are on the `VelocityHelpers` object.\nTo have less to write in your tests, you can export the testing helpers to the global namespace by putting this code into one of your spec files:\n\n```js\nbeforeAll(function () {\n  VelocityHelpers.exportGlobals();\n});\n```","excerpt":"The velocity:helpers package provide common test helpers to make common testing tasks straight forward.","slug":"velocity-helpers","type":"basic","title":"Velocity Helpers"}

Velocity Helpers

The velocity:helpers package provide common test helpers to make common testing tasks straight forward.

[block:api-header] { "type": "basic", "title": "Install" } [/block] [block:code] { "codes": [ { "code": "meteor add velocity:helpers", "language": "shell" } ] } [/block] [block:api-header] { "type": "basic", "title": "Testing helpers" } [/block] In addition to this documentation, also look at [the specs](https://github.com/meteor-velocity/velocity-helpers/tree/master/specs) for them. This will give you example usages. All testing helpers are methods on the `VelocityHelpers` global. * **getElement(selector: string, context: element)** Like `$(selector, context)` but it throws an error when the element has not been found. * **getMethod(methodName: string)** Returns the requested Meteor method function. * **getMethods()** Returns a hash of all Meteor methods. * **spyOnMethod(methodName: string) (Jasmine only)** Gives you a [spy](http://jasmine.github.io/2.3/introduction.html#section-Spies) for a Meteor method. * **stubMethod(methodName: string, error: Object, result: Object) (Jasmine only)** Replaces the real Meteor method call with a stub that immediately calls the callback with the `error` and `result` objects you pass to this method. * **waitFor(check: function, successCallback: function) (Jasmine only)** Waits until the check function returns true and then calls the success callback. https://github.com/meteor-velocity/velocity-helpers [block:api-header] { "type": "basic", "title": "Expose helpers globally" } [/block] By default all testing helpers are on the `VelocityHelpers` object. To have less to write in your tests, you can export the testing helpers to the global namespace by putting this code into one of your spec files: ```js beforeAll(function () { VelocityHelpers.exportGlobals(); }); ```