2 /* ------------ Test cases ------------ */
5 asyncTest("simple api call", function() {
6 CRM
.api3('contact', 'get').done(function(result
) {
7 equal(result
.is_error
, 0, 'contact get failed');
12 module('api multiple');
14 asyncTest("array api calls", function() {
16 ['email', 'get', {email
: '@'}],
17 ['phone', 'get', {phone
: '123'}]
19 CRM
.api3(params
).done(function(result
) {
20 equal(result
[0].is_error
, 0, 'email get failed');
21 equal(result
[1].is_error
, 0, 'phone get failed');
26 asyncTest("named api calls", function() {
28 one
: ['email', 'getoptions', {field
: 'location_type_id'}],
29 two
: ['phone', 'get', {field
: 'phone_type_id'}]
31 CRM
.api3(params
).done(function(result
) {
32 ok(result
.one
.count
> 0, 'email getoptions failed');
33 ok(result
.two
.count
> 0, 'phone getoptions failed');