Skip to content

Commit

Permalink
completed test for timeout()
Browse files Browse the repository at this point in the history
  • Loading branch information
xpl committed Dec 5, 2017
1 parent 6ba810c commit 4856cc9
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions js/test/test_base.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const ccxt = require ('../../ccxt.js')
const chai = require ('chai')
.use (require ('chai-as-promised'))
.should ()

/* ------------------------------------------------------------------------ */

describe ('ccxt base code', () => {
Expand Down Expand Up @@ -63,13 +63,8 @@ describe ('ccxt base code', () => {

assert ('foo', await ccxt.timeout (200, new Promise (resolve => setTimeout (() => resolve ('foo'), 100))))

try {
await ccxt.timeout (200, new Promise (resolve => setTimeout (() => resolve ('foo'), 100)))
throw new Error ('should throw an exception')
} catch (e) {

}

await ccxt.timeout (100, Promise.reject ('foo')).should.be.rejectedWith ('foo')
await ccxt.timeout (100, new Promise ((resolve, reject) => setTimeout (() => reject ('foo'), 200))).should.be.rejectedWith ('request timed out')
})

it ('calculateFee() works', () => {
Expand Down

0 comments on commit 4856cc9

Please sign in to comment.