"use strict"; let assert = require('assert'); let imClient = require('../../src/client/im.client'); let userId = 'D2016008240002'; describe('API: Doctor Search', function () { // 搜索所有 describe('search all object types', function () { it('should return 200', function (done) { imClient.Sessions.Search.Doctor.searchAll(userId, '哦', false, function (data) { assert(data.messages.length > 0, "Search must return at least one data"); console.log(JSON.stringify(data)); done(); }, function (xhr, status, error) { assert.ok(false, xhr.responseJSON.message); done(); }); }); }); // 搜索医生 describe('search doctor', function () { it('should return 200', function (done) { imClient.Sessions.Search.Doctor.searchDoctors(userId, '张', 1, 10, function (data) { assert(data.users.length > 0, "Search must return at least one data"); console.log(JSON.stringify(data)); done(); }, function (xhr, status, error) { assert.ok(false, xhr.responseJSON.message); done(); }); }); }); // 搜索会话 describe('search sessions', function () { it('should return 200', function (done) { imClient.Sessions.Search.Doctor.searchSessions('D2016008240003', '丽', false, 1, 10, function (data) { assert(data.sessions.length > 0, "Search must return at least one data"); console.log(JSON.stringify(data)); done(); }, function (xhr, status, error) { assert.ok(false, xhr.responseJSON.message); done(); }); }); }); // 搜索会话消息 describe('search messages', function () { it('should return 200', function (done) { imClient.Sessions.Search.Doctor.searchMessages(userId, '哦', 1, 10, function (data) { assert(data.messages.length > 0, "Search must return at least one data"); console.log(JSON.stringify(data)); done(); }, function (xhr, status, error) { assert.ok(false, xhr.responseJSON.message); done(); }); }); }); });