Skip to content

Commit

Permalink
test: update test setup
Browse files Browse the repository at this point in the history
master
  • Loading branch information
trs committed May 4, 2017
1 parent eb32f93 commit 2eac41d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 26 deletions.
18 changes: 8 additions & 10 deletions test/index.spec.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
/* eslint no-unused-expressions: 0 */
require('dotenv').load();
const {expect} = require('chai');
const bunyan = require('bunyan');
const fs = require('fs');

const FtpServer = require('../src');
const FtpClient = require('ftp');

before(() => require('dotenv').load());

describe('FtpServer', function () {
this.timeout(2000);
let log = bunyan.createLogger({name: 'test', level: 10});
let log = bunyan.createLogger({name: 'test'});
log.level(process.env.LOG_LEVEL || 'debug');
let server;
let client;

Expand All @@ -21,14 +23,9 @@ describe('FtpServer', function () {
server.on('login', (data, resolve) => {
resolve({root: process.cwd()});
});
process.on('SIGINT', function () {
server.close();
});

require('child_process').exec(`sudo kill $(sudo lsof -t -i:${server.url.port})`, () => {
server.listen()
.finally(() => done());
});
server.listen()
.then(() => done());
});
after(() => {
server.close();
Expand All @@ -38,6 +35,7 @@ describe('FtpServer', function () {
expect(server).to.exist;
client = new FtpClient();
client.once('ready', () => done());
client.once('error', err => done(err));
client.connect({
host: server.url.hostname,
port: server.url.port,
Expand Down Expand Up @@ -236,7 +234,7 @@ describe('FtpServer', function () {
});

it('QUIT', done => {
client.once('close', done)
client.once('close', done);
client.logout(err => {
expect(err).to.be.undefined;
});
Expand Down
16 changes: 0 additions & 16 deletions test/start.js

This file was deleted.

0 comments on commit 2eac41d

Please sign in to comment.