From: Tim Otten Date: Fri, 19 Jul 2013 02:21:16 +0000 (-0700) Subject: CRM-12943: Cleanup X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=5eccc9581334847b6abba6adf50f355a2fa9aad5;p=civicrm-core.git CRM-12943: Cleanup ---------------------------------------- * CRM-12943 http://issues.civicrm.org/jira/browse/CRM-12943 --- diff --git a/tests/qunit/crm-backbone/test.js b/tests/qunit/crm-backbone/test.js index ed870c23d6..09a84457fa 100644 --- a/tests/qunit/crm-backbone/test.js +++ b/tests/qunit/crm-backbone/test.js @@ -1,4 +1,4 @@ -/* ------ Fixtures/constants ----- */ +/* ------------ Fixtures/constants ------------ */ var VALID_CONTACT_ID = 3; var INVALID_CONTACT_ID = 'z'; @@ -11,12 +11,21 @@ var ContactCollection = Backbone.Collection.extend({ }); CRM.Backbone.extendCollection(ContactCollection); -/* ------ Assertions ------ */ +/* ------------ Assertions ------------ */ +/** + * Assert "result" contains an API error + * @param result + */ function assertApiError(result) { equal(1, result.is_error, 'Expected error boolean'); ok(result.error_message.length > 0, 'Expected error message') } + +/** + * When calling an AJAX operation which should return successfully, + * make sure that there's no error by setting a callback (error: onUnexpectedError) + */ function onUnexpectedError(ignore, result) { if (result && result.error_message) { ok(false, "API returned an unexpected error: " + result.error_message); @@ -25,12 +34,17 @@ function onUnexpectedError(ignore, result) { } start(); } + +/** + * When calling an AJAX operation which should return an error, + * make sure that there's no success by setting a callback (success: onUnexpectedSuccess) + */ function onUnexpectedSuccess(ignore) { ok(false, "API succeeded - but failure was expected"); start(); } -/* ------ Test cases ------ */ +/* ------------ Test cases ------------ */ module('model - read'); @@ -57,7 +71,6 @@ asyncTest("fetch (error)", function() { }); }); - module('model - create'); asyncTest("create/read/delete/read (ok)", function() {