Skip to content

Commit

Permalink
fix(deps): drop dependency on through2 (#388)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith authored Jul 22, 2019
1 parent 5421d08 commit 56e2534
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 20 deletions.
1 change: 0 additions & 1 deletion packages/google-cloud-dialogflow/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
"nyc": "^14.0.0",
"power-assert": "^1.4.4",
"prettier": "^1.7.4",
"through2": "^3.0.0",
"linkinator": "^1.5.0"
}
}
4 changes: 1 addition & 3 deletions packages/google-cloud-dialogflow/samples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,14 @@
"resources"
],
"engines": {
"node": ">=8.0.0"
"node": ">=10.0.0"
},
"scripts": {
"test": "mocha system-test --timeout=600000"
},
"dependencies": {
"dialogflow": "^0.10.2",
"pb-util": "^0.1.0",
"pump": "^3.0.0",
"through2": "^3.0.0",
"uuid": "^3.3.2",
"yargs": "^13.0.0"
},
Expand Down
19 changes: 11 additions & 8 deletions packages/google-cloud-dialogflow/test/gapic-v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
'use strict';

const assert = require('assert');
const through2 = require('through2');
const {PassThrough} = require('stream');

const dialogflowModule = require('../src');

Expand Down Expand Up @@ -2818,13 +2818,16 @@ function mockSimpleGrpcMethod(expectedRequest, response, error) {

function mockBidiStreamingGrpcMethod(expectedRequest, response, error) {
return () => {
const mockStream = through2.obj((chunk, enc, callback) => {
assert.deepStrictEqual(chunk, expectedRequest);
if (error) {
callback(error);
} else {
callback(null, response);
}
const mockStream = new PassThrough({
objectMode: true,
transform: (chunk, enc, callback) => {
assert.deepStrictEqual(chunk, expectedRequest);
if (error) {
callback(error);
} else {
callback(null, response);
}
},
});
return mockStream;
};
Expand Down
19 changes: 11 additions & 8 deletions packages/google-cloud-dialogflow/test/gapic-v2beta1.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
'use strict';

const assert = require('assert');
const through2 = require('through2');
const {PassThrough} = require('stream');

const dialogflowModule = require('../src');

Expand Down Expand Up @@ -3697,13 +3697,16 @@ function mockSimpleGrpcMethod(expectedRequest, response, error) {

function mockBidiStreamingGrpcMethod(expectedRequest, response, error) {
return () => {
const mockStream = through2.obj((chunk, enc, callback) => {
assert.deepStrictEqual(chunk, expectedRequest);
if (error) {
callback(error);
} else {
callback(null, response);
}
const mockStream = new PassThrough({
objectMode: true,
transform: (chunk, enc, callback) => {
assert.deepStrictEqual(chunk, expectedRequest);
if (error) {
callback(error);
} else {
callback(null, response);
}
},
});
return mockStream;
};
Expand Down

0 comments on commit 56e2534

Please sign in to comment.