|
15 | 15 | */ |
16 | 16 |
|
17 | 17 | import * as assert from 'assert'; |
18 | | -import {describe, it, before, beforeEach, afterEach, after} from 'mocha'; |
| 18 | +import {describe, it, before, beforeEach, afterEach} from 'mocha'; |
19 | 19 | import {grpc} from 'google-gax'; |
20 | 20 | import * as proxyquire from 'proxyquire'; |
21 | 21 | import * as sinon from 'sinon'; |
@@ -302,13 +302,7 @@ describe('MessageStream', () => { |
302 | 302 |
|
303 | 303 | describe('destroy', () => { |
304 | 304 | it('should noop if already destroyed', done => { |
305 | | - sandbox |
306 | | - .stub(FakePassThrough.prototype, 'destroy') |
307 | | - .callsFake(function (this: Duplex) { |
308 | | - if (this === messageStream) { |
309 | | - done(); |
310 | | - } |
311 | | - }); |
| 305 | + messageStream.on('close', done); |
312 | 306 |
|
313 | 307 | messageStream.destroy(); |
314 | 308 | messageStream.destroy(); |
@@ -350,36 +344,6 @@ describe('MessageStream', () => { |
350 | 344 | assert.strictEqual(stub.callCount, 1); |
351 | 345 | }); |
352 | 346 | }); |
353 | | - |
354 | | - describe('without native destroy', () => { |
355 | | - let destroy: (err?: Error) => void; |
356 | | - |
357 | | - before(() => { |
358 | | - destroy = FakePassThrough.prototype.destroy; |
359 | | - // eslint-disable-next-line @typescript-eslint/no-explicit-any |
360 | | - FakePassThrough.prototype.destroy = false as any; |
361 | | - }); |
362 | | - |
363 | | - after(() => { |
364 | | - FakePassThrough.prototype.destroy = destroy; |
365 | | - }); |
366 | | - |
367 | | - it('should emit close', done => { |
368 | | - messageStream.on('close', done); |
369 | | - messageStream.destroy(); |
370 | | - }); |
371 | | - |
372 | | - it('should emit an error if present', done => { |
373 | | - const fakeError = new Error('err'); |
374 | | - |
375 | | - messageStream.on('error', err => { |
376 | | - assert.strictEqual(err, fakeError); |
377 | | - done(); |
378 | | - }); |
379 | | - |
380 | | - messageStream.destroy(fakeError); |
381 | | - }); |
382 | | - }); |
383 | 347 | }); |
384 | 348 |
|
385 | 349 | describe('pull stream lifecycle', () => { |
|
0 commit comments