Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Commit

Permalink
Merge pull request #13 from zeroturnaround/update-deps
Browse files Browse the repository at this point in the history
Update all dependencies
  • Loading branch information
Erik H authored Jun 10, 2019
2 parents 30b5dfc + ace472f commit 74b428b
Show file tree
Hide file tree
Showing 7 changed files with 3,236 additions and 1,674 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@
"test"
],
"devDependencies": {
"babel-eslint": "^7.2.3",
"eslint": "^4.0.0",
"eslint-config-zt": "^1.4.0",
"jest": "19.0.0",
"request": "^2.81.0"
"babel-eslint": "^10.0.1",
"eslint": "^5.16.0",
"eslint-config-zt": "^2.0.0",
"jest": "24.8.0",
"request": "^2.88.0"
},
"main": "./lib/hock",
"scripts": {
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"deep-equal": "0.2.1"
"deep-equal": "1.0.1"
},
"jest": {
"roots": [
Expand Down
154 changes: 80 additions & 74 deletions test/many-test.js

Large diffs are not rendered by default.

38 changes: 22 additions & 16 deletions test/replyWithFile-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,55 @@ const {
createPort
} = require("./util.js");

describe("min() and max() with replyWithFile", function() {
beforeEach(function(done) {
this.port = createPort();
this.hockInstance = hock.createHock();
this.httpServer = createHttpServer(this.hockInstance, this.port, done);
describe("min() and max() with replyWithFile", () => {
let testContext;

beforeEach(() => {
testContext = {};
});

beforeEach(done => {
testContext.port = createPort();
testContext.hockInstance = hock.createHock();
testContext.httpServer = createHttpServer(testContext.hockInstance, testContext.port, done);
});

afterEach(function(done) {
this.httpServer.close(done);
afterEach(done => {
testContext.httpServer.close(done);
});

it('should succeed with a single call', function(done) {
this.hockInstance
it('should succeed with a single call', done => {
testContext.hockInstance
.get('/url')
.replyWithFile(200, process.cwd() + '/test/data/hello.txt');

catchErrors(done, () => {
request('http://localhost:' + this.port + '/url', (err, res, body) => {
request('http://localhost:' + testContext.port + '/url', (err, res, body) => {
expectResponse(err, res, body, {statusCode: 200, expectedBody: 'this\nis\nmy\nsample\n'});

this.hockInstance.done((err) => {
testContext.hockInstance.done((err) => {
expect(err).toBeFalsy();
done();
});
});
});
});

it('should succeed with a multiple calls', function(done) {
this.hockInstance
it('should succeed with a multiple calls', done => {
testContext.hockInstance
.get('/url')
.twice()
.replyWithFile(200, process.cwd() + '/test/data/hello.txt');

catchErrors(done, () => {
request('http://localhost:' + this.port + '/url', (err, res, body) => {
request('http://localhost:' + testContext.port + '/url', (err, res, body) => {
expectResponse(err, res, body, {statusCode: 200, expectedBody: 'this\nis\nmy\nsample\n'});

catchErrors(done, () => {
request('http://localhost:' + this.port + '/url', (err, res, body) => {
request('http://localhost:' + testContext.port + '/url', (err, res, body) => {
expectResponse(err, res, body, {statusCode: 200, expectedBody: 'this\nis\nmy\nsample\n'});

this.hockInstance.done((err) => {
testContext.hockInstance.done((err) => {
expect(err).toBeFalsy();
done();
});
Expand Down
6 changes: 3 additions & 3 deletions test/request-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const Request = require('../lib/request');

describe('request', function() {
it('should work with defined headers in the incoming request', function() {
describe('request', () => {
it('should work with defined headers in the incoming request', () => {
const request = new Request({}, {
method: 'GET',
url: '/lowercasetest',
Expand All @@ -15,7 +15,7 @@ describe('request', function() {
}));
});

it('should work with defined headers in the incoming request', function() {
it('should work with defined headers in the incoming request', () => {
const request = new Request({}, {
method: 'GET',
url: '/lowercasetest',
Expand Down
Loading

0 comments on commit 74b428b

Please sign in to comment.