1 /* ------------ Test cases ------------ */
4 asyncTest("simple api call", function() {
5 CRM
.api3('contact', 'get').done(function(result
) {
6 equal(result
.is_error
, 0, 'contact get');
11 module('api multiple');
13 asyncTest("array api calls", function() {
15 ['email', 'get', {email
: '@'}],
16 ['phone', 'get', {phone
: '123'}]
18 CRM
.api3(params
).done(function(result
) {
19 equal(result
[0].is_error
, 0, 'email get');
20 equal(result
[1].is_error
, 0, 'phone get');
25 asyncTest("named api calls", function() {
27 one
: ['email', 'getoptions', {field
: 'location_type_id'}],
28 two
: ['phone', 'getoptions', {field
: 'phone_type_id', sequential
: 1}],
29 three
: ['phone', 'get']
31 CRM
.api3(params
).done(function(result
) {
32 ok(result
.one
.count
> 0, 'email getoptions');
33 ok(result
.two
.count
> 0, 'phone getoptions');
34 ok(result
.three
.count
> 0, 'phone get');