2017-04-17 131 views
0

我希望對ARI做一個測試!但我不能請求與星號連接。當我運行我的文件與節點它確定,但如果我運行它與摩卡沒有結果!做一個摩卡測試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(); 

}); });

+0

它沒有單元測試。你的單位取決於外部的迴應。只是嘲笑它。 –

+0

我在...之前嘗試過,沒有任何東西 –

回答

0

那麼,它只是解決一個,但強烈建議嘲笑外部API calls-

試戴

它( 「應該打個電話」,函數(完成){

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 
    });   

});