12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- "use strict";
- let assert = require('assert');
- let imClient = require('../../src/client/im.client');
- let userId = 'D2016008240002';
- describe('API: Search', function () {
- // 搜索所有
- describe('search all object types', function () {
- it('should return 200', function (done) {
- imClient.Search.searchAll(userId, '哦',
- function (data) {
- assert(data.length > 0, "Search must return at least one data");
- },
- function (xhr, status, error) {
- assert.ok(false, xhr.responseJSON.message);
- done();
- });
- });
- });
- // 搜索医生
- describe('search doctors', function () {
- it('should return 200', function (done) {
- imClient.Search.searchDoctors('张',
- function (data) {
- assert(data.length > 0, "Search must return at least one data");
- },
- function (xhr, status, error) {
- assert.ok(false, xhr.responseJSON.message);
- done();
- });
- });
- });
- // 搜索会话
- describe('search sessions', function () {
- it('should return 200', function (done) {
- imClient.Search.searchSessions(userId, '小',
- function (data) {
- assert(data.length > 0, "Search must return at least one data");
- },
- function (xhr, status, error) {
- assert.ok(false, xhr.responseJSON.message);
- done();
- });
- });
- });
- // 搜索会话消息
- describe('search sessions', function () {
- it('should return 200', function (done) {
- imClient.Search.searchMessages(userId, '哦',
- function (data) {
- assert(data.length > 0, "Search must return at least one data");
- },
- function (xhr, status, error) {
- assert.ok(false, xhr.responseJSON.message);
- done();
- });
- });
- });
- });
|