1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- "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();
- });
- });
- });
- });
|