"use strict"; let assert = require('assert'); let imClient = require('../../src/client/im.client'); let userId = 'D2016008240003'; describe('API: Patient Search', function () { // 搜索所有 describe('search all object types', function () { it('return a message', function (done) { imClient.Sessions.Search.Patient.searchAll(userId, '哦', false, function (data) { assert(data.messages.length > 0, "Search must return at least one data"); console.log(data); done(); }, function (xhr, status, error) { assert.ok(false, xhr.responseJSON.message); done(); }); }); }); // 搜索患者 describe('search patients', function () { it('return a patient', function (done) { imClient.Sessions.Search.Patient.searchPatient(userId, '丽', 1, 10, function (data) { assert(data.users.length > 0, "Search must return at least one data"); console.log(data); done(); }, function (xhr, status, error) { assert.ok(false, xhr.responseJSON.message); done(); }); }); }); // 搜索会话 describe('search sessions', function () { it('return a session', function (done) { imClient.Sessions.Search.Patient.searchSessions(userId, '廖小', false, 1, 10, function (data) { assert(data.sessions.length > 0, "Search must return at least one data"); console.log(data); done(); }, function (xhr, status, error) { assert.ok(false, xhr.responseJSON.message); done(); }); }); }); // 搜索会话消息 describe('search messages', function () { it('return at least one message', function (done) { imClient.Sessions.Search.Patient.searchMessages(userId, '哦', 1, 10, function (data) { assert(data.messages.length > 0, "Search must return at least one data"); console.log(data); done(); }, function (xhr, status, error) { assert.ok(false, xhr.responseJSON.message); done(); }); }); }); });