message: Test pass with loop instead of sleep
diff: @@ -58,14 +58,11 @@ describe('A Connection object with ', function () {
  connection.create("connection_connect tests")
  var f = function(){
  - console.log("****** inside waitforConnect ******")
  var state = connection.getState()
  - console.log("****** state: " + state + " ******")
  return connection.connect({sms: true}) === 0
  }
  assert(waitForConnect(f))
  - //assert.equal(connection.connect({sms: true}), 0)
  })
  it(' a call to create with no connection created should return unknown error', function () {
  @@ -89,74 +86,10 @@ describe('A Connection object with ', function () {
  it('a call to get_data where connection was released should return a null value', function () {
  assert.equal(connection.create("connection_get_data tests"), 0)
  -
  - assert.equal(connection.connect({sms: true}), 0)
  - assert.equal(connection.getState(),StateType.OfferSent)
  -
  - var data = connection.getData()
  - assert.notEqual(data, null)
  - assert.equal(connection.release(), 0)
  -
  -
  - data = connection.getData()
  - assert.equal(data, null)
  -
  - })
  - it.only('a call to get_data where connection was released should return a null value', function () {
  - /*
  - var createConnection = function(){
  - return new Promise((resolve,reject) =>{
  - resolve(connection.create("promise release"))
  - });
  - }
  -
  - var waitThreeSeconds= function(){
  - return new Promise((resolve,reject) =>{
  - mysleep.usleep(3000)
  - resolve()
  - });
  - }
  -
  - var connectConnection = function() {
  - return new Promise((resolve,reject) => {
  - assert.equal(connection.connect({sms: true}),0)
  - resolve()
  - });
  - }
  -
  - var connectGetState = function() {
  - return new Promise((ressolve, reject) => {
  -
  - connection.getState()
  - resolve()
  - })
  - }
  - */
  - // createConnection().then().then(connectConnection)
  - const releaseTest = async () => {
  - connection.create("promise release")
  - console.log("###############################")
  - // await sleep(4000)
  for (i = 1; i< 100000000; i++){
  -
  - }
  - assert.equal(connection.connect({sms: true}),0)
  - assert.equal(connection.getState(),StateType.OfferSent)
  -
  - var data = connection.getData()
  - assert.notEqual(data, null)
  - assert.equal(connection.release(), 0)
  -
  -
  - data = connection.getData()
  - assert.equal(data, null)
  + // we need to wait
  }
  - releaseTest()
  -
  - /*
  - assert.equal(connection.create("promise release"), 0)
  -
  assert.equal(connection.connect({sms: true}), 0)
  assert.equal(connection.getState(),StateType.OfferSent)
  @@ -167,7 +100,6 @@ describe('A Connection object with ', function () {
  data = connection.getData()
  assert.equal(data, null)
  - */
  })
  