Fix tests not running multiple times in a row

This commit is contained in:
haad 2016-02-03 17:27:18 +07:00
parent 6a2635c9c3
commit 202c35057a

View File

@ -25,20 +25,19 @@ const username = 'testrunner';
const password = '';
const startServer = async (() => {
// TODO: this should be handled by orbit-server
if(!fs.existsSync(serverConfig.userDataPath))
fs.mkdirSync(serverConfig.userDataPath);
return new Promise(async((resolve, reject) => {
logger.setLevel('ERROR');
const ipfsd = await(ipfsDaemon());
const server = Server(ipfsd.daemon, ipfsd.nodeInfo, serverConfig);
server.app.listen(port, () => {
resolve(server);
}).on('error', (err) => {
resolve(server);
});
}));
});
describe('Orbit Client', () => {
let server, orbit;
@ -62,8 +61,9 @@ describe('Orbit Client', () => {
if(orbit) orbit.channel(channel, '').delete();
resolve();
}));
deleteChannel().then(done);
server.shutdown();
server = null;
deleteChannel().then(done);
});
/* TESTS */