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