var Douban = require('../index.js'),
    mocha = require('mocha'),
    should = require('should'),
    fs = require('fs');

var douban = new Douban({
    
});

describe("Douban book API", function() {
    it("Douban search book", function(done) {
        douban.search({
                q: "香港基本法的成功实践",
            start: 0,
            count: 5
        }, function(err, data) {
           data.books[0].id.should.not.be.empty;
           done();
        });
    });
    it("Douban search book by ISBN", function(done) {
       douban.searchByIsbn("7301045700", function(err, data) {
           data.id.should.not.be.empty;
           done();
       });
    });
    it("Douban get book info", function(done) {
        douban.info(1259108, function(err, data) {
            data.id.should.not.be.empty;
            done();
        });
    });
    it("Douban get book tags", function(done) {
        this.timeout(5000);
        douban.tags(1259108, function(err, data) {
           data.tags[0].name.should.not.be.empty;
           done(); 
        });
    });
});
var Douban = require('../index.js'),
    mocha = require('mocha'),
    should = require('should'),
    fs = require('fs');

var douban = new Douban({
    
});

describe("Douban book API", function() {
    it("Douban search book", function(done) {
        this.timeout(5000);
        douban.search({
                q: "香港基本法的成功实践",
            start: 0,
            count: 5
        }, function(err, data) {
           data.books[0].id.should.not.be.empty;
           done();
        });
    });
    it("Douban search book by ISBN", function(done) {
       this.timeout(5000);
       douban.searchByIsbn("7301045700", function(err, data) {
           data.id.should.not.be.empty;
           done();
       });
    });
    it("Douban get book info", function(done) {
        this.timeout(5000);
        douban.info(1259108, function(err, data) {
            data.id.should.not.be.empty;
            done();
        });
    });
    it("Douban get book tags", function(done) {
        this.timeout(5000);
        douban.tags(1259108, function(err, data) {
           data.tags[0].name.should.not.be.empty;
           done(); 
        });
    });
});
add timeout 5000ms