summaryrefslogtreecommitdiffstats
path: root/test/helper.js
blob: 74f461a1324e4528f1b744503574c92eb1366213 (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.parse()
	    .then(function() {
	    	return global.book2.parse();
	    }),
	    done
	);
});