const list = require('../lib/index').list
const should = require('chai').should
const constants = require('../src/constants')
should()


describe('list api test', function() {
  this.timeout(60000)
  it('should list torrent', function() {
    return list().then(data => {
      data.length.should.above(0)
    })
  })

  it('should list torrent using movie category', function() {
    return list({ category: constants.CATEGORY.MOVIES_FULL_BD }).then(data => {
      data.length.should.above(0)
      data[0].category.toLowerCase().should.equal('movies/full bd')
    })
  })

  it('should list torrent and limit 100 torrent', function() {
    return list({ limit: 100 }).then(data => {
      data.length.should.equal(100)
    })
  })

  it('should list torrent sort by seeders', function() {
    return list({ sort: 'seeders' }).then(data => {
      data.length.should.above(0)
      data[0].seeders.should.above(data[1].seeders)
    })
  })

  it('should list torrent using simple json format', function() {
    return list({ format: 'json' }).then(data => {
      data.length.should.above(0)
      Object.keys(data[0]).length.should.equal(3)
    })
  })
})

@@ -169,16 +169,248 @@
 ion() %7B%0A
+  beforeEach(function(done) %7B%0A    this.timeout(60000)%0A    // ensure every test wait 2sec before sending the real request,%0A    // because of the api's frequency limitation.%0A    setTimeout(function() %7B%0A      done()%0A    %7D, 2000)%0A  %7D)%0A%0A
   this.t

update test