123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- "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");
- console.log(data);
- done();
- },
- function (xhr, status, error) {
- assert.ok(false, xhr.responseJSON.message);
- done();
- });
- });
- });
- // 搜索医生
- describe('search doctors', function () {
- it('should return 200', function (done) {
- imClient.Search.searchDoctors(userId, '张', 1, 10,
- function (data) {
- assert(data.length > 0, "Search must return at least one data");
- done();
- },
- 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, '小', 1, 10,
- 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, '哦', 1, 10,
- function (data) {
- assert(data.length > 0, "Search must return at least one data");
- },
- function (xhr, status, error) {
- assert.ok(false, xhr.responseJSON.message);
- done();
- });
- });
- });
- });
|