summaryrefslogtreecommitdiffstats
path: root/test/helper.js
blob: f9723b9375309dbe65dd838186ddb12bc32aa87c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
var path = require('path');
var Q = require('q');
var Book = require('../').Book;

// Nicety for mocha / Q
global.qdone = function qdone(promise, done) {
    return promise.then(function() {
        return done();
    }, function(err) {
        return done(err);
    }).done();
};

// Init before doing tests
before(function(done) {
    global.book1 = new Book(path.join(__dirname, './fixtures/test1'));
    global.book2 = new Book(path.join(__dirname, './fixtures/test2'));

    qdone(
	    global.book1.init()
	    .then(function() {
	    	return global.book2.init();
	    }),
	    done
	);
});