为ARI文件做一个mocha测试?

时间:2017-04-17 15:31:12

标签: node.js testing mocha

我希望为ARI做一个测试!但我不能要求与星号连接。我用节点运行我的文件确定它,但如果我用摩卡运行它没有结果!

let chai = require('chai');
let request = require('request');
let uuid = require('uuid');
let should = chai.should();
let ari = require('ari-client');
let expect = chai.expect;
let sinon = require('sinon');

describe('Tests originationDevice ', function () {

it(" should make a call ", function (done) {

    ari.connect("http://192.168.0.62:8088", "username", "password")
        .then(function (ari) {
            console.log('its okey');
        })
        .catch(function (err) {
            console.log('errrror');
        });        

 done();

}); });

1 个答案:

答案 0 :(得分:0)

嗯,它只是解决方案之一,但强烈建议模拟外部api调用 -

尝试 -

它(“应该打电话”,功能(完成){

ari.connect("http://192.168.0.62:8088", "username", "password")
    .then(function (ari) {
        console.log('its okey');
        res.should.true; // something like that.
        done(); // calling done function
    })
    .catch(function (err) {
        console.log('errrror');
        // assert something
        done(); // call done function
    });        

});