launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #10455
[Merge] lp:~jcsackett/launchpad/helpers-docs into lp:launchpad
j.c.sackett has proposed merging lp:~jcsackett/launchpad/helpers-docs into lp:launchpad.
Requested reviews:
Richard Harding (rharding)
For more details, see:
https://code.launchpad.net/~jcsackett/launchpad/helpers-docs/+merge/117457
Summary
=======
LPClient is a useful helper for YUI tests on modules that use LPClient. Sadly,
it's barely documented.
QA
==
None; this just adds documentation.
LoC
===
The LoC change in this is +, but it's just comments, no significant lines of
code.
Lint
====
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/app/javascript/testing/helpers.js
--
https://code.launchpad.net/~jcsackett/launchpad/helpers-docs/+merge/117457
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
=== modified file 'lib/lp/app/javascript/testing/helpers.js'
--- lib/lp/app/javascript/testing/helpers.js 2012-07-16 22:41:33 +0000
+++ lib/lp/app/javascript/testing/helpers.js 2012-07-31 15:11:20 +0000
@@ -19,6 +19,12 @@
};
+ /**
+ * Testing mock for lp.client.
+ *
+ * Useful for testing calls to lp.client in other code, though it requires
+ * the other code be setup so that it can accept a passed in client.
+ */
ns.LPClient = function () {
if (!(this instanceof ns.LPClient)) {
throw new Error("Constructor called as a function");
@@ -38,6 +44,15 @@
this._call('get', config, arguments);
};
}
+ /**
+ * Captures call data and simulates callbacks.
+ *
+ * The function called and the arguments it's called with are added to the
+ * LPCLient's `received` attribute.
+ * Callback behavior are governed by the args set on the called; args can
+ * bet set to nothing, but must exist or an error is thrown.
+ * @method
+ */
ns.LPClient.prototype._call = function(name, config, args) {
this.received.push(
[name, Array.prototype.slice.call(args)]);
Follow ups